Regex Tester
Test JavaScript regex matches and inspect indices
Enter a regex, flags and test text to inspect matched values and indices. Advanced mode shows numbered capture groups and more examples.
About this tool
Test a JavaScript regular expression against text and inspect matched values, UTF-16 index positions and numbered capture groups. The g flag controls first-match versus all-match output; zero-length matches advance correctly, including Unicode code points with u. This uses the browserβs native RegExp engine without an execution timeout, not PCRE or RE2.
Examples
Empty matches advance past a complete code point
text
Pattern: (?:)
Flags: gu
Text: πA
Match indices: 0, 2, 3Frequently Asked Questions
Which flags are accepted?
g, i, m, s, u, y and d, subject to browser support. Duplicate flags are removed and other letters are discarded. Named-group syntax may work, but the results panel lists capture groups by position.
What changes when g is off?
Only the first match is returned. With g on, matches continue through the input; empty matches do not get stuck at the same index. Indices count UTF-16 code units, so an emoji may occupy two positions.
Can any pattern run safely on a large input?
No. Nested or ambiguous quantifiers can cause catastrophic backtracking and block the browser. Use a small bounded sample; this tool does not sandbox or time-limit native regex execution.
Keep browsing