Regex Tester
Type a JavaScript regular expression and test text. Matches highlight live, capture groups and indices show in a clean list, replace mode previews substitutions, and a cheat sheet keeps syntax close at hand.
Your patterns and test text are processed entirely in your browser.
How to use this regex tester
- Type your pattern between the / / and toggle flags (g, i, m, s, u, y).
- Paste your test text — every match highlights live with capture groups numbered.
- Switch to Replace mode to preview substitutions ($1, $2, $<name>, $&).
- Use the common patterns or open the cheat sheet for syntax help.
Frequently asked questions
Which regex flavor is supported?
JavaScript regex (ECMAScript), the same engine your browser uses. That's slightly different from PCRE / Python — most syntax overlaps but lookbehind support and certain Unicode classes vary.
Are matches limited?
The first 200 matches are listed in detail; the highlighter shows all of them. There's a 50,000-match safety stop for runaway patterns.
What about lookbehind?
Modern browsers support both lookahead (?=…)(?!…) and lookbehind (?<=…)(?<!…). The tester runs in your browser, so it matches your browser's exact regex behavior.
Why does my regex work in this tester but fail in my Python or PHP code?
JavaScript regex, PCRE (Perl, PHP), Python's `re` and POSIX all have small but breaking differences: named-group syntax, lookbehind support, Unicode property classes, possessive quantifiers. Test in the engine that will actually run the regex — what works in your browser may not work on the server.