Testing and Debugging Regular Expressions
What this tester does
A regular expression is a compact pattern that describes a set of strings — the shape of an email, a date, a phone number, or any recurring text structure. This tool compiles the pattern you type using your browser's JavaScript regex engine and runs it against your sample text the moment you make a change, so there is no separate 'run' step. Every substring that matches is highlighted in place, and a details panel lists each match with its captured groups and character position.
Because it uses the same engine that powers RegExp in JavaScript and Node.js, what you see here is exactly what your code will do.
When to use it
Reach for it whenever a pattern is not behaving the way you expected. Instead of scattering console.log statements and re-running a script, you paste representative text, adjust the pattern, and watch the highlights shift in real time. It is equally useful for building a pattern from scratch — start loose, then tighten it until only the intended matches light up.
The live statistics — total matches, group count, pattern and text length, and processing time — help you spot catastrophic backtracking or an accidentally greedy quantifier before it reaches production.
Example: matching a date
Suppose you want to pull ISO dates out of a log. The pattern (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) matches 2026-07-18 and splits it into three named groups: year, month, and day. With the g flag enabled, every date in the text is captured, not just the first. Swapping \d{2} for \d{1,2} would also accept single-digit months like 2026-7-8.
Notes and edge cases
Flags change everything: i makes the match case-insensitive, m lets ^ and $ anchor to each line, s allows the dot to match newlines, and u enables full Unicode handling. Remember that characters like . * + ? ( ) [ ] { } \ | ^ $ are special and must be escaped with a backslash to match them literally — to find a literal dot, write \. rather than ., which matches any character. Unnamed groups are numbered from 1 in the order their opening parenthesis appears, while (?:...) creates a group that does not capture.