Regex Tester
Test a regular expression against sample text with live match highlighting.
No matches yet
Type a pattern and some test text. Matching happens as you type, and is time-boxed so a runaway pattern cannot freeze the page.
Runs entirely in your browser. Your data isn't uploaded — this page makes no network request with anything you type, which you can verify in your browser's network tab. How this works.
What is the Regex Tester?
Regular expressions are written by trial and error, so the speed of the feedback loop determines how good the result is. Seeing which parts of your sample text match, and what each capture group contains, turns guesswork into something closer to debugging.
This tester runs JavaScript regular expressions — the flavour used in Node, browsers and many config formats — highlights every match live as you type, lists numbered and named groups, previews replacements, and breaks the pattern down token by token in plain English.
How to use it
- Type your pattern in the pattern field and set the flags you need (g, i, m, s, u).
- Paste sample text — ideally including cases that should not match.
- Matches highlight as you type; hover or click one to see its capture groups.
- Use the Replace tab to preview a replacement string with $1 and $<name> references.
Example
A pattern with a named group, tested against sample log lines.
pattern: ^(?<level>WARN|ERROR)\s+(?<msg>.+)$ flags: gm
match 1 level=WARN msg=disk 82% full match 2 level=ERROR msg=upstream timeout 2 matches, 2 named groups
Features
- Live match highlighting as you type
- Numbered and named capture group tables per match
- Replacement preview with backreference support
- Token-by-token explanation of the pattern
- Flag toggles with an explanation of each
- Catastrophic backtracking guard so a runaway pattern cannot hang the page
- Shareable link containing the pattern and flags (never the test text)