MENU
Quick reference for regular expression syntax. Common patterns and examples.
| Pattern | Description |
|---|---|
. | Any character except newline |
\d | Digit (0-9) |
\D | Not a digit |
\w | Word character (a-z, A-Z, 0-9, _) |
\W | Not a word character |
\s | Whitespace |
\S | Not whitespace |
| Pattern | Description |
|---|---|
^ | Start of string |
$ | End of string |
\b | Word boundary |
\B | Not word boundary |
| Pattern | Description |
|---|---|
* | 0 or more |
+ | 1 or more |
? | 0 or 1 |
{3} | Exactly 3 |
{3,} | 3 or more |
{3,5} | Between 3 and 5 |
| Pattern | Description |
|---|---|
(abc) | Capture group |
(?:abc) | Non-capturing group |
(?=abc) | Positive lookahead |
(?!abc) | Negative lookahead |
| Pattern | Description |
|---|---|
[a-z] | Lowercase letter |
[A-Z] | Uppercase letter |
[0-9] | Digit |
[a-zA-Z] | Any letter |
[^abc] | Not a, b, or c |
Email:
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}URL:
https?://[^\s/$.?#].[^\s]*Phone (US):
\d{3}-\d{3}-\d{4}Hex Color:
#[0-9a-fA-F]{6}