Regex Tester - Real-Time Match Highlighting
Test JavaScript regular expressions in real time. Matched portions are highlighted and capture groups are displayed.
Enter a pattern and text to see results
How to Use
- Enter your regular expression pattern in the top input field (no slashes needed)
- Set flags (g, i, m, s, u) using the checkboxes. The g flag (global match) is ON by default
- Enter the text you want to match against in the test string area
- Matched portions are highlighted in real time, along with the match count and capture groups
Usage Examples
Matching email addresses: Pattern: [\w.+-]+@[\w-]+\.[\w.]+ Test: user@example.com, invalid-email → Matches: user@example.com
Matching digits only: Pattern: \d+ Test: abc 123 def 456 → Matches: 123, 456
Using capture groups:
Pattern: (\d{4})-(\d{2})-(\d{2})
Test: 2026-02-19
→ Group 1: 2026, Group 2: 02, Group 3: 19
FAQ
- Is my data sent to a server?
- No. All processing is done by your browser's JavaScript engine.
- What regex flavor is used?
- JavaScript's native RegExp is used. It may differ slightly from PCRE (Perl-compatible regex).
- What happens if I turn off the g flag?
- Only the first match is returned (equivalent to match() without global). It's generally recommended to keep g enabled to see all matches.
- Could a complex pattern freeze the browser?
- Processing is capped at 10,000 matches. Be cautious with ReDoS-prone patterns (catastrophic backtracking).
- Are named capture groups (?<name>...) supported?
- All syntax supported by JavaScript is available, including named capture groups. However, the results table shows them by group number.
Related Tools
Update History
Last Updated: 2026-02-20
- 2026-02-20 Initial release