Quick reference
| Pattern | Matches |
|---|---|
. | Any character except a line break (any at all with the s flag) |
\d \w \s | Digit, word character (letter, digit, _), whitespace |
[abc] [^abc] [a-z] | One of, none of, a range |
* + ? {2,5} | 0 or more, 1 or more, 0 or 1, between 2 and 5 |
*? +? | Lazy versions: as few as possible |
^ $ \b | Start, end (of line with m), word boundary |
(…) (?:…) (?<name>…) | Capture group, non-capturing group, named group |
(?=…) (?!…) (?<=…) (?<!…) | Lookahead, negative lookahead, lookbehind, negative lookbehind |
The full list, with examples, is in the regex cheat sheet.
Frequently asked questions
Which regex flavour does this tester use?
JavaScript (ECMAScript), because it runs your pattern with the browser’s own RegExp engine. That matches Node.js, Deno and TypeScript exactly. Most syntax is shared with PCRE, Python and Java, but some features differ, such as possessive quantifiers and atomic groups, which JavaScript does not support.
Why does my regex only find the first match?
Without the g (global) flag, a JavaScript regex stops at the first match. Add g to find all of them, as this tester does by default.
How do I match a literal dot or bracket?
Escape it with a backslash: \. matches a dot, \( a bracket, \$ a dollar sign. Inside a character class, most characters are literal, so [.] also matches a dot.
What does the u flag do?
It turns on Unicode mode: the pattern treats emoji and other characters outside the basic plane as single characters, and allows \p{…} property escapes such as \p{L} for any letter in any language.