About this tool
This regex tester runs a JavaScript regular expression against your sample text as you type and shows every match highlighted in place, a table of matches with their positions and numbered and named capture groups, and a live preview of a replacement string that can use $1, $2, and
How it works
The pattern and flags are compiled with the browser's native RegExp constructor, so behavior matches what JavaScript does in production, including Unicode handling under the u flag and lookbehind support. To list matches the tool always iterates with the global flag using exec in a loop, advancing one character after a zero-length match to avoid infinite loops, and stops after 5,000 matches. If you leave g unchecked only the first match is reported, as String.prototype.match would return. Replacement runs the actual String.prototype.replace or replaceAll with your pattern and replacement string, so $1,
Frequently asked questions
What do the flags mean?
g finds all matches instead of stopping at the first. i ignores case. m makes ^ and $ match at line breaks rather than only at the start and end of the text. s lets the dot match newline characters. u turns on full Unicode mode, needed for \p{...} classes and for treating emoji as single characters. y (sticky) matches only at the exact position where the previous match ended, which is rarely what you want in a tester.
Why does my pattern that works in Python or PCRE fail here?
JavaScript regex differs from PCRE and Python in a few places: there are no possessive quantifiers or atomic groups, no inline modifiers like (?i), no \A or \Z anchors (use ^ and $ without m), and named groups use (?<name>...) with \k<name> for back-references. Lookbehind (?<=...) is supported in all current browsers. Unicode property escapes such as \p{L} require the u flag.
How do I use capture groups in the replacement?
Refer to numbered groups as $1, $2, and so on, to named groups as
Is the match table limited?
Yes, to 5,000 matches, so a pattern that matches every character in a long text does not freeze the page. The count, highlighting, and replacement still cover the whole text; only the table stops at the cap and says so. If you need more, narrow the pattern or shorten the sample.