Regex Tester
Test JavaScript regular expressions with live highlighting, capture groups and a replace preview. Nothing leaves your browser.
Matches 0
Match details
Replace
Cheat sheet
| . | Any character except newline (all with s) |
|---|---|
| \d \w \s | Digit, word character, whitespace |
| \D \W \S | Not digit / word / whitespace |
| [abc] [^abc] | Any of / none of a, b, c |
| [a-z] | Character range |
| ^ $ | Start / end of input (of line with m) |
| \b \B | Word boundary / not a boundary |
| * + ? | 0 or more, 1 or more, 0 or 1 |
|---|---|
| {3} {2,5} {2,} | Exactly 3, 2 to 5, 2 or more |
| *? +? | Lazy (as few as possible) |
| (โฆ) (?:โฆ) | Capture group / non-capturing group |
| (?<name>โฆ) | Named group, reference with \k<name> |
| a|b | a or b |
| (?=โฆ) (?!โฆ) | Lookahead / negative lookahead |
| (?<=โฆ) (?<!โฆ) | Lookbehind / negative lookbehind |
| \p{L} | Unicode property (needs u) |
Uses your browser's JavaScript regex engine. Matching runs in a background worker and is stopped after 1 second, so runaway patterns like (a+)+$ can't freeze the page.