Regex Tester
Test JavaScript regular expressions against sample text with inline match highlighting, capture groups, named groups, and a replace preview.
Processed locally in your browser — nothing is uploaded.
0 characters
About Regex Tester
Write a pattern, pick flags, and see every match highlighted in your test string as you type. Each match is listed with its index, numbered capture groups, and named groups from (?<name>…) syntax. Invalid patterns show the exact engine error instead of failing silently.
Replace mode previews the result of .replace() with a template, including $1, $<name>, and $& references — handy for checking a substitution before it goes into code.
Common uses
- Debug why a pattern matches too much or too little
- Extract capture groups from sample log lines
- Preview a search-and-replace before running it across a codebase
Example
Input
pattern (?<year>\d{4}) against "born 1815"Output
1 match · year: 1815
Limitations
- Uses your browser's JavaScript regex engine — PCRE-only syntax (possessive quantifiers, recursion) won't work
- Without the g flag only the first match is reported, mirroring JavaScript semantics