Skip to content
AZ Tools

Regex Tester

Write a regular expression, toggle the flags, and see every match highlighted in your test string as you type. Capture groups are listed per match and a replacement preview runs alongside, so you can confirm both what the pattern finds and what it would produce. The engine is the browser's own JavaScript RegExp, which means what you see here is exactly what your code will do — including the places JavaScript differs from PCRE, Python or Go. Nothing is sent anywhere: patterns and test data stay in the page, which matters when the sample you are debugging is real data.

Flags
Matches2 match(es)
Contact me at jane@example.com or john@test.io for details.
  • #1 @14jane@example.com
  • #2 @34john@test.io
Replacement preview
Contact me at [redacted] or [redacted] for details.

How to use

  1. Enter a regex pattern (without delimiters).
  2. Toggle flags: g (global), i (case-insensitive), m (multiline), s (dotall), u (unicode).
  3. Type or paste a test string — matches highlight as you type.
  4. Provide a replacement string to preview the result.

Frequently asked questions

What dialect does this use?
JavaScript regex (ECMAScript). Lookbehinds, named groups, and Unicode property escapes are supported in modern browsers.
How do I reference capture groups in the replacement?
Use $1, $2, $& for the full match, or $<name> for named groups.
Is there a match limit?
The first 10,000 iterations are captured to keep the UI responsive; the first 50 are shown in the match list.
Is my data sent anywhere?
No. Patterns and test strings run only in your browser, and the auto-save keeps them in your local storage.
Why does my pattern freeze the page?
Almost certainly catastrophic backtracking. Patterns that nest quantifiers - something like (a+)+b - can force the engine through an exponential number of ways to split the input before admitting there is no match. The fix is to make the inner parts unambiguous, usually by replacing a greedy .* with a negated character class that cannot overlap the delimiter.
What does the global flag actually change?
Without g, matching stops at the first result. With g, the search continues through the string, which is what makes the match list longer than one - and it also makes the regular expression stateful in real code, because it remembers where it stopped. That is the usual reason a pattern reused in a loop appears to skip every other match.
How do I match across multiple lines?
Two different flags are involved and they are easy to confuse. Multiline changes what the anchors mean, so ^ and $ match at every line break instead of only at the ends of the string. Dot-all changes what the dot matches, letting it cover newlines too. If a pattern stops at the end of the first line, dot-all is usually the one you wanted.

Guides on this topic

Related tools