Regex syntax differs by engine (JavaScript, PCRE, Python, RE2, etc.). This page uses JavaScript-style syntax as the baseline.
| Pattern | Meaning |
|---|---|
. | Any char except line terminator (default) |
\d | Digit |
\D | Not a digit |
\w | Word character (engine-dependent Unicode behavior) |
\s | Whitespace |
[abc] | One of a/b/c |
[^abc] | Not a/b/c |
^ | Start |
$ | End |
* | 0 or more |
+ | 1 or more |
? | 0 or 1 / lazy modifier in some contexts |
{n} | Exactly n |
{n,m} | n to m |
(abc) | Capturing group |
(?:abc) | Non-capturing group |
a|b | Alternation |
(?=x) | Positive lookahead |
(?!x) | Negative lookahead |
JavaScript flags
| Flag | Meaning |
|---|---|
g | global |
i | ignore case |
m | multiline |
s | dotAll |
u | Unicode mode |
v | Unicode sets mode (modern JS engines) |
y | sticky |
Continue with a tool
Sources & update policy
Verified: 2026-08-31. This page prioritizes primary standards and official registries. Time-sensitive items should be rechecked against the linked source.