.*

Regex Tester

Test JavaScript regex matches and inspect indices

Regex & String
πŸ”’ 100% client-side β€” your data never leaves this page
Maintained by Evanβ€’Updated: September 29, 2026
Options
Regex

Enter a regex, flags and test text to inspect matched values and indices. Advanced mode shows numbered capture groups and more examples.

//
Test string
πŸ”’ Processed locally in your browser
Output
Matches will appear here
Page reading mode

The full guide also includes pitfalls, worked examples, snippets, FAQs, and related tools for checking results or troubleshooting.

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.

Production Snippets

Empty matches advance past a complete code point

text

Pattern: (?:)
Flags: gu
Text: πŸ˜€A
Match indices: 0, 2, 3

Frequently 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