Regex Tester
Test regular expressions live. JavaScript ECMAScript flavor — the same engine your browser, Node.js backend, and Bun runtime use. See matches highlighted, capture groups extracted, and replacements previewed as you type. Catastrophic backtracking is caught with a 2-second timeout.
How to use the regex tester
Enter your pattern in the top field (without surrounding slashes — the tester adds them). Set flags
on the right: g for global match, i for case-insensitive, m
for multiline, s for dotall, u for full Unicode, y for sticky.
Paste your test string in the larger field. The tester runs on every change with a short debounce
so you can iterate quickly.
For replacement, fill the replace field — you can use $1, $2 for numbered
groups or $<name> for named groups. The result panel shows both the match list
and the replaced output.
JavaScript regex features you'll actually use
- Character classes:
\d,\w,\s,\band inverses (\D,\W,\S,\B). - Quantifiers:
?,+,*,{n},{n,},{n,m}. Add?after for lazy matching. - Capture groups:
(...)numbered,(?:...)non-capturing,(?<name>...)named. - Lookarounds:
(?=X)positive lookahead,(?!X)negative,(?<=X)lookbehind,(?<!X)negative lookbehind. - Unicode property escapes (with
uflag):\p{L}any letter,\p{Emoji}emoji,\p{Script=Cyrillic}etc.
Common patterns to copy
| Pattern | Matches |
|---|---|
^\d{4}-\d{2}-\d{2}$ | ISO 8601 date (YYYY-MM-DD) |
\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b | Email (case-insensitive with i flag) |
https?://[\w.-]+(?:/[\w./?=&%-]*)? | URL (loose) |
\b(?:[0-9a-f]{8}-){3}[0-9a-f]{12}\b | UUID v4 (loose) |
(?:^|\s)#([A-Za-z0-9_]+) | Hashtags |
\b\w{6,}\b | Words 6+ characters |
Frequently asked questions
Which regex flavor does this use?
Does it support named capture groups?
(?<year>\d{4}) defines a named group; matches show both numeric indices and names. Use $<name> in the replacement field.Why is my regex slow?
(a+)+ or alternations that overlap can take exponential time on long strings. The tester will time out at 2 seconds and report which input character it was stuck on — that's usually enough to spot the runaway.Can I test against multi-line input?
m flag to make ^ and $ match line boundaries. Add s to make . match newlines.