Regex Tester

Type a pattern and test text — matches highlight live, groups listed below.

How to test a pattern

  1. Type your regular expression in the Pattern field, without surrounding slashes. The page loads with an email-matching pattern already in place so you can see the tester working.
  2. Set flags in the flags field: g, i, m, s, u in any combination. The default is gi, global and case-insensitive.
  3. Paste your test text below. Matches highlight in amber immediately, and every keystroke in any of the three fields re-runs the test.
  4. Read the match list underneath: each match shows its number, character offset, matched text, and any capture groups.

A worked example: pulling dates out of a log line

Set the pattern to (\d{4})-(\d{2})-(\d{2}) and paste deployed 2026-07-21, rolled back 2026-07-22 as the test text. Both dates highlight, and the match list reads:

#1 @9: "2026-07-21"  groups: ["2026", "07", "21"]
#2 @33: "2026-07-22"  groups: ["2026", "07", "22"]

The @ numbers are zero-based character offsets, and the groups array shows what each parenthesized section captured, in order. A group that participates in the pattern but matches nothing displays as ∅ rather than an empty string, a distinction that matters when you are debugging optional groups.

What flavor you are testing, and why it matters

This tester runs your pattern through your browser's own JavaScript regex engine via new RegExp, so what you see is exactly what your JavaScript code will do, including edge cases. That cuts both ways: most patterns behave identically to PCRE, but if you are writing regex for Python or PHP, verify lookbehind and certain escapes in the target language. When your pattern is invalid, the tester shows the browser parser's exact error message instead of a generic "invalid", which usually names the offending character. Two safety details are built in: matching stops after 5,000 matches, and zero-length matches advance by one character instead of looping forever, so a pattern like a* cannot hang the page. Test text never leaves your browser.

Honest limitations

There is no replace mode: you can see what matches, but not preview a substitution. Named groups match fine, but the group list displays them positionally without their names. The g flag is effectively always on, because highlighting all matches requires it; if you specifically need first-match-only semantics, read only the #1 line in the match list. And catastrophic backtracking is real: a pathological pattern like nested quantifiers over a long non-matching string can still freeze the tab, since the 5,000 match cap limits successful matches, not the engine's search time. If the page stops responding after a pattern edit, that pattern was the problem, and it would have been the problem in production too, which is arguably the tester doing its job.

Frequently asked questions

Which regex flavor does this use?

JavaScript (ECMAScript) regex, as implemented by your browser. Most patterns behave identically to PCRE, but lookbehind support and some escapes can differ from Python or PHP flavors.

What do the flags mean?

g finds all matches instead of the first; i ignores case; m makes ^ and $ match at line breaks; s lets the dot match newlines; u enables full Unicode matching.

Why does my pattern say "invalid"?

The exact browser parser error is shown, most often an unescaped special character like ( ) [ ] or a dangling backslash. Escape literals with a backslash: \( matches a real parenthesis.