Debug regular expressions faster
Regular expressions are powerful but easy to get subtly wrong. This tester runs your pattern with the browser’s JavaScript regex engine — the same one used by Node.js, Deno and every browser — and shows the results as you type: matches are highlighted in the text, and a table lists each match with its position and capture groups, including named groups such as (?<year>\d{4}).
Flags
| Flag | Effect |
|---|---|
g | global – find all matches instead of stopping at the first |
i | ignore case |
m | multiline – ^ and $ match at every line break |
s | dotAll – . also matches line breaks |
u | unicode – full Unicode support, enables \p{L} property escapes |
Quick reference
| Token | Matches |
|---|---|
\d \w \s | digit, word character, whitespace (uppercase = the opposite) |
. | any character except a line break |
[abc] [^abc] [a-z] | character sets and ranges |
* + ? {2,5} | quantifiers; add ? to make them lazy |
^ $ \b | start, end, word boundary |
(…) (?:…) (?<name>…) | capturing, non-capturing and named groups |
a|b | alternation |
(?=…) (?!…) (?<=…) | lookahead, negative lookahead, lookbehind |
Enter the pattern without the surrounding slashes. Backslashes are typed once (\d), not doubled as in a string literal.
Frequently asked questions
Which regex flavour does this use?
JavaScript (ECMAScript). Most syntax is shared with PCRE, Python and Java, but some features such as possessive quantifiers or atomic groups are not available in JavaScript.
Why does my pattern freeze or run slowly?
Nested quantifiers like (a+)+ can cause catastrophic backtracking. Make the pattern more specific. The tester stops after 5,000 matches to stay responsive.
How do I match a literal dot or bracket?
Escape it with a backslash: \. \( \[ .
Is my text uploaded?
No. Matching runs in your browser.