Regex Parser Tester
Test regular expressions with live match highlighting, token-by-token breakdowns, and sample string generation
- Pattern explanation will appear here.
How To Use
Enter Pattern
Type your regex and select relevant flags.
Test Live Text
See highlighted matches and capture groups in real time.
Interpret and Generate
Review pattern explanation and generate example strings.
FAQ
Yes. You can toggle global, ignore case, multiline, dotAll, unicode, and sticky flags in the tester.
The parser reads your pattern token by token and generates plain-language explanations for anchors, classes, groups, and quantifiers.
Yes. The sample generator creates a representative string using your current pattern so you can quickly sanity-check intent.
A greedy quantifier like .* consumes as much as possible, then backtracks; its lazy twin .*? stops at the first match. On the text say "hi" bye, the pattern "..*" captures the whole line, while ".*?" captures only hi. Greedy is the default - append ? to make any quantifier lazy.
Parentheses capture: (\d{4})-(\d{2}) against 2026-09-19 gives group 1 = 2026 and group 2 = 09, and in a replace pattern $1 reuses the captured text. Named groups like (?<year>\d{4}) read better in complex patterns. JavaScript numbers groups by their opening parenthesis, starting at 1 - group 0 is always the whole match.
Add u whenever the pattern or the text involves non-ASCII characters: it makes \w and \d follow Unicode rules, enables property escapes like \p{L} and \p{Script=Arabic}, and treats emoji as single characters. Without u, a UTF-16 surrogate pair can be split in half by a dot match.
By default ^ and $ anchor the whole string and . skips line breaks. The m (multiline) flag makes ^ and $ match at every line boundary instead, and the s (dotAll) flag lets . cross newlines. A common recipe for log parsing is both flags together: /error.*timeout/gms.
It runs the JavaScript engine in your browser, so it follows ECMAScript (ECMA-262) regex semantics - the same engine String.prototype.match uses in production JS. Note the differences from PCRE or Python: JavaScript has no \K or recursion, and lookbehind arrived only in ES2018. Patterns written for Perl or PCRE may need small adjustments.
Related Tools
Authoritative References
Primary sources behind this tool - official standards and specifications, not secondhand summaries.
MDN Web Docs - Regular Expressions
Mozilla JavaScript RegExp reference: syntax, flags, and named capture groups.
ECMA-262 - ECMAScript Language Specification
The official ECMAScript language specification chapter on regular expressions.
Regular expression - Wikipedia
Regular expression history and concepts: from Perl heritage to modern engines.