🧪 Regex Tester
Test JavaScript regular expressions live — match, replace, or split, with capture-group breakdown.
/
/
Flags:
Mode:
g global ·
i case-insensitive ·
m multiline (^/$ per line) ·
s dotAll (. matches newlines) ·
u unicode ·
y sticky ·
d indices on captures
Samples:
🔍 Explain this regex
Type a pattern above to see a token-by-token breakdown.
📋 Copy as code
Runnable JavaScript snippet — paste into any console or playground.
📖 Cheat sheet
Anchors & classes
| ^ $ | start / end of string (line in m mode) |
| \b \B | word / non-word boundary |
| . | any char except newline (matches all in s mode) |
| \d \D | digit / non-digit |
| \w \W | word char / non-word char |
| \s \S | whitespace / non-whitespace |
| [abc] [^abc] | any of / not any of |
| [a-z] | character range |
Quantifiers & groups
| * + ? | zero+ / one+ / optional |
| {n} {n,} {n,m} | exactly / at least / range |
| *? +? ?? | lazy variants |
| (abc) | capturing group |
| (?:abc) | non-capturing group |
| (?<name>abc) | named group — back-ref via $<name> |
| (?=abc) | lookahead |
| (?!abc) | negative lookahead |
| (?<=abc) | lookbehind |
| (?<!abc) | negative lookbehind |
| a|b | alternation |