Regex Tester
?
About regex matching
- Why does my pattern behave differently with the g flag on or off?
- Without g, only the first match in the whole test string is found — this mirrors what a plain regex.exec() call or String.match() returns without the flag. With g, every non-overlapping match is found, and .replace() replaces all of them instead of just the first.
- What's the difference between (...), (?:...), and (?<name>...)?
- (...) is a capturing group — its match is numbered (1, 2, 3…) and listed separately for each match below. (?:...) groups a pattern (for applying a quantifier or alternation to it) without capturing it into the results. (?<name>...) is a capturing group with a name instead of just a number, useful for pulling a specific piece out of a longer pattern by name.
- Why did my pattern seem to freeze, or take a long time?
- Certain patterns — typically nested quantifiers like (a+)+ — can take exponentially longer to fail than to succeed against certain input, a well-known regex pitfall called catastrophic backtracking. Matching here runs in a background worker with a timeout, so the page itself won't freeze, but a pattern like that still won't produce a result — simplifying the nested repetition usually fixes it.
- Does this tool upload my data anywhere?
- No. Matching runs entirely in your browser — in a background worker thread rather than blocking the page, but never on a server. Nothing you type ever leaves your device.
Test regular expressions against sample text with live match and capture-group highlighting.
Regex syntax reference (click a token to insert it into the pattern at the cursor)
Character classes
Anchors & boundaries
Quantifiers
Groups & alternation
Lookaround
Escapes & backreferences
Flags
gglobaliignore casemmultilinesdot alluunicodeystickyCommon patterns (click to try one)
⚠ This pattern has nested repetition that can cause catastrophic backtracking on certain input — consider simplifying it.
Find & replace (optional)
- matches
- 0
- status
- idle