Regex Tester
Test and debug regular expressions
How to use
- Enter your regex pattern
- Add test strings
- View matches and groups
Use cases
- Form validation
- Text processing
- Data extraction
- Pattern matching
About the Regex Tester
Regular expressions are the Swiss army knife of pattern matching — used in form validation, log parsing, code search, routing rules, and data extraction. They're also notoriously hard to debug because a single character can change matching behavior dramatically. This tester runs your regex in a Web Worker so a catastrophic pattern can't freeze the page, and highlights every match with its capture groups inline.
Features
- Web Worker execution — catastrophic regex can't freeze your browser
- 1.5 s timeout kill switch for ReDoS patterns like (a+)+b
- Global, case-insensitive, multiline, dotAll flag controls
- Numbered and named capture group display
- Live highlighted match preview over the test string
How it works
- Type your regex pattern (no need for leading / trailing slashes).
- Toggle the flags you need — g, i, m, s.
- Paste your test string.
- See matches highlighted in real time; inspect capture groups below.
Frequently asked questions
Why does my regex hang on some inputs?
+
Nested quantifiers like (a+)+b cause catastrophic backtracking on non-matching strings. The engine explores exponentially many paths. Our Web Worker implementation kills the regex at 1.5 s.
What are named capture groups?
+
Groups of the form (?<name>pattern) that you can reference by name in the result, e.g., match.groups.name. Much clearer than numbered groups for complex regex.
Does this support lookbehind?
+
Yes — lookbehind ((?<=) and (?<!)) is supported in modern browsers. IE and older Safari don't support it.
Why does removing the 'g' flag change the match count?
+
Without 'g', .match() and .exec() only return the first match. With 'g', they return every match. The tool faithfully mirrors this behavior.
Can I use this to replace text?
+
Substitution mode is on the roadmap. For now, use the match output to reason about what your regex captures.