About Regex Tester
Regular expressions are written by trial and error even by people who know them well, and the loop of edit, run, squint at the output is far faster when the matches are highlighted in place. Every match is numbered, and its capture groups are listed underneath, so you can see immediately whether group 2 is picking up what you think it is.
The replace preview matters as much as the match view. A pattern that matches correctly can still produce the wrong output once $1 and $<name> references are involved, and seeing the result before running it against real data saves a lot of grief.
One warning the tool gives that most do not: catastrophic backtracking. A pattern like (a+)+$ can take exponential time on a non-matching string, and JavaScript offers no way to interrupt a running regex — the tab simply freezes. Patterns with that shape are flagged before you run them, and the input length is capped.
How to test a regular expression
Enter your pattern
Type it directly, or load one from the library as a starting point.
Set the flags
Global for every match, ignore case, multiline for ^ and $ at each line break.
Paste a test string
Matches are highlighted as you type, with each one numbered.
Check the groups
Expand any match to see its numbered and named capture groups.
The flags, and what they actually do
- g (global) — find every match rather than stopping at the first.
- i (ignore case) — match regardless of capitalisation.
- m (multiline) — ^ and $ match at each line break instead of only at the ends of the string.
- s (dotall) — let . match newline characters too.
- u (unicode) — enable \p{...} property escapes and correct handling of characters outside the BMP.
- y (sticky) — match only from the position where the last match ended.
Catastrophic backtracking
Some patterns take exponential time on inputs that do not match. The classic shape is a repeated group whose contents are themselves repeated — (a+)+ — where the engine has an enormous number of ways to split the input before it can conclude there is no match.
This matters more in a browser than almost anywhere else, because a running regular expression cannot be interrupted: the tab freezes until it finishes, which may be never. Rewriting the pattern to remove the nested quantifier is almost always possible and always the right fix.