Regex Tester
Test regular expressions with live match highlighting, match positions, and capture groups.
Deep Dive
Test regular expressions against sample text in real time with live match highlighting. Supports all JavaScript regex flags (`g`, `i`, `m`, `s`, `u`), named capture groups, and displays each match's index and captured groups. No data leaves your browser.
Who uses this?
- Building and testing an email validation regex
- Extracting dates or phone numbers from a block of text
- Debugging a complex search-and-replace pattern
- Learning regex syntax interactively
Examples
Input
Contact us at hello@karuvilab.com or support@example.orgOutput
Matches: hello@karuvilab.com, support@example.orgInput
Order #4521 ships in 3 daysOutput
Matches: 4521, 3Common Errors & Fixes
Regex throws 'Invalid regular expression'
Check for unmatched parentheses, brackets, or unescaped special characters in the pattern.
Pattern only matches once even with the global flag
Ensure the `g` flag is enabled. Without it, `RegExp.exec` and `String.match` return only the first match.
Catastrophic backtracking causes the browser to hang
Simplify nested quantifiers (e.g., `(a+)+`). These can cause exponential time complexity on certain inputs.
Expert FAQ
Which regex flavor does this use?
JavaScript's built-in `RegExp` engine. Most common patterns are compatible, but features like lookbehinds require a modern browser (Chrome 62+, Firefox 78+).
Why does my regex match nothing?
Check that special characters (`.`, `*`, `+`, `?`, `(`, `)`) are escaped with a backslash if you want them treated literally.
What are flags and when do I use them?
`g` finds all matches (not just the first), `i` ignores case, `m` makes `^` and `$` match line boundaries, `s` makes `.` match newlines.
Can I use named capture groups?
Yes. Use `(?<name>...)` syntax. Named groups are displayed alongside numeric groups in the match list.