


We use cookies to improve your experience
We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience.
7 sections · 47 items
| Code / Syntax | Description |
|---|---|
. | Any character except newline |
\d | Any digit (0-9) |
\D | Any non-digit |
\w | Any word character (a-z, A-Z, 0-9, _) |
\W | Any non-word character |
\s | Any whitespace (space, tab, newline) |
\S | Any non-whitespace character |
[abc] | Any one of a, b, or c |
[^abc] | Any character except a, b, or c |
[a-z] | Any character in range a to z |
[A-Z0-9] | Any uppercase letter or digit |
| Code / Syntax | Description |
|---|---|
* | Zero or more times |
+ | One or more times |
? | Zero or one time (optional) |
{3} | Exactly 3 times |
{2,5} | Between 2 and 5 times |
{2,} | 2 or more times |
*? | Zero or more (lazy / non-greedy) |
+? | One or more (lazy / non-greedy) |
| Code / Syntax | Description |
|---|---|
^ | Start of string (or line in multiline mode) |
$ | End of string (or line in multiline mode) |
\b | Word boundary |
\B | Non-word boundary |
\A | Start of string (never matches after newline) |
\Z | End of string (before final newline if any) |
| Code / Syntax | Description |
|---|---|
(abc) | Capturing group |
(?:abc) | Non-capturing group |
(?<name>abc) | Named capturing group |
\1 | Back-reference to group 1 |
(a|b) | Alternation — match a or b |
(?P<name>abc) | Named group (Python syntax) |
| Code / Syntax | Description |
|---|---|
(?=abc) | Positive lookahead — followed by abc |
(?!abc) | Negative lookahead — not followed by abc |
(?<=abc) | Positive lookbehind — preceded by abc |
(?<!abc) | Negative lookbehind — not preceded by abc |
| Code / Syntax | Description |
|---|---|
g | Global — match all occurrences |
i | Case-insensitive matching |
m | Multiline — ^ and $ match line start/end |
s | Dotall — . matches newline characters |
u | Unicode — enable full Unicode matching |
y | Sticky — match from lastIndex position |
| Code / Syntax | Description |
|---|---|
^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,}$ | Email address (basic) |
^https?://[\w.-]+(?:\.[a-zA-Z]{2,})(?:/\S*)?$ | URL (basic) |
^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$ | IPv4 address |
^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ | Hex color code |
^\d{4}-\d{2}-\d{2}$ | Date (YYYY-MM-DD) |
^\+?\d{1,4}[-.\s]?\d{3,14}$ | Phone number (international) |