Common regular expression tokens and ready-to-use patterns. Download: CSV · JSON.
| Token / pattern | Meaning |
|---|---|
. | Any character except newline |
\d | Digit 0-9 |
\w | Word character [A-Za-z0-9_] |
\s | Whitespace |
^ $ | Start / end of line |
\b | Word boundary |
a* | Zero or more a |
a+ | One or more a |
a? | Zero or one a |
a{2,4} | Two to four a |
[abc] | Any of a, b, c |
[^abc] | Not a, b, or c |
(abc) | Capture group |
(?:abc) | Non-capturing group |
a|b | a or b |
(?=x) | Positive lookahead |
(?!x) | Negative lookahead |
^\d{3}-\d{4}$ | Simple phone number |
^[^@\s]+@[^@\s]+\.[^@\s]+$ | Basic email check |
^\d{5}(-\d{4})?$ | US ZIP code |
^#?[0-9a-fA-F]{6}$ | Hex color |
^https?://\S+$ | Basic URL |
^\d{4}-\d{2}-\d{2}$ | ISO date YYYY-MM-DD |