Regex Tester (JavaScript)
Test a regular expression against your text and see every match highlighted as you type. This regex tester uses the JavaScript engine, shows capture groups and named groups, and previews a replacement.
- Live highlighting
- Capture groups
- Replace preview
- No sign-up
How to use
- Type your regular expression in the pattern box and choose the flags.
- Paste or type the text to test. Matches are highlighted at once.
- Open the list under the text to see every match, its position and the capture groups.
- Type a replacement such as $2-$1 to preview the result.
JavaScript regex basics
\d is a digit, \w a word character, \s whitespace, . any character, + one or more, * zero or more, ? optional, and ( ) a capture group. Use (?<name>...) for named groups. Flags change behaviour: g finds all matches, i ignores case, m lets ^ and $ match each line, s lets the dot match line breaks.
Engine differences
This tester uses your browser's JavaScript engine. Other languages (Python, PCRE, Java) have small differences, for example in lookbehind and named group syntax. Test the result there before you use it. To compare outputs side by side try text compare.
Frequently asked questions
Which regex flavor does it use?
JavaScript (ECMAScript), as built into your browser.
Why do I only see one match?
Turn on the g (global) flag to find all matches instead of the first one.
Is my text uploaded?
No. Matching runs in your browser only.
What happens with a pattern that never ends?
The tester stops at 2,000 matches. A badly written pattern can still slow your browser, so simplify it if the page hangs.