| Pattern |
Description |
| [abc] |
Matches any single character inside the brackets. |
| [^abc] |
Matches any single character not inside the brackets. |
| . |
Matches any character except newline characters. |
| \d |
Matches any digit character (0-9). |
| \D |
Matches any non-digit character. |
| \w |
Matches any word character (letters, digits, underscore). |
| \W |
Matches any non-word character. |
| \s |
Matches any whitespace character (spaces, tabs, line breaks). |
| \S |
Matches any non-whitespace character. |
| \t |
Matches a tab character. |
| \n |
Matches a newline character. |
| \r |
Matches a carriage return character. |
| \uhhhh |
Matches a Unicode character specified by the four hexadecimal digits. |
| \xhh |
Matches a character specified by the two hexadecimal digits. |
| Pattern |
Description |
| (x) |
Captures the matched substring. |
| (?:x) |
Groups without capturing. |
| (?<name>x) |
Captures the matched substring into a named group. |
| \n |
Backreference to the nth captured group. |
| \k<name> |
Backreference to a named capturing group. |
| x(?=y) |
Matches "x" only if followed by "y". |
| x(?!y) |
Matches "x" only if not followed by "y". |
| (?<=y>x) |
Matches "x" only if preceded by "y". |
| (?<!y>x) |
Matches "x" only if not preceded by "y". |