Regex Tester
Test regular expressions.
Pattern
JavaScript flavor (ECMAScript). No /…/ delimiters.
Test text
Match details
- @9
john@example.com
- @29
jane.doe+work@startup.io
Replace (optional)
How this tool works
Regular expressions (regex) are a compact language to describe text patterns. A single line can validate emails, extract URLs, parse logs or transform CSV. The catch: debugging them by eye is brutal.
This tester compiles your regex with JavaScript's native engine, highlights each match, lists captured groups and lets you live-test replacements. It supports g (global), i (case-insensitive), m (multiline), s (dotall) and u (unicode) flags.
How to use it, step by step
- 1
Write your pattern
Without the /…/ slashes. Just the regex body.
- 2
Toggle flags
g for all matches; i for case-insensitive; m so ^/$ work per line.
- 3
Paste test text
The more representative, the better. Edge cases: empty strings, unicode, line breaks.
- 4
Inspect groups
Captured groups are indexed. Use (?<name>...) for named groups.
Frequently asked questions
- Which regex flavor?
- JavaScript ECMAScript. Syntax differs slightly from PCRE (PHP, grep) or POSIX. When porting, watch out for lookbehinds, \K and backreferences.
- Any ReDoS protection?
- Chrome's engine is fairly robust, but catastrophic patterns (a+a+)+ can hang the tab. Keep that in mind before pasting unknown regexes.
- Can I use it for emails?
- Yes, but the 'perfect' email regex is huge. For 99% of cases:
^\S+@\S+\.\S+$then validate with a real send.