Regex Features Reference

Character Classes

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.

Anchors and Boundaries

Pattern Description
^ Matches the beginning of a line or string.
$ Matches the end of a line or string.
\b Matches a word boundary position.
\B Matches a position that is not a word boundary.

Quantifiers

Pattern Description
x* Matches zero or more occurrences of "x".
x+ Matches one or more occurrences of "x".
x? Matches zero or one occurrence of "x".
x{n} Matches exactly "n" occurrences of "x".
x{n,} Matches at least "n" occurrences of "x".
x{n,m} Matches between "n" and "m" occurrences of "x".
x*?, x+?, x?? Non-greedy versions of the quantifiers.

Groups and Lookarounds

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".

Special Characters and Escape Sequences

Pattern Description
x|y Matches either "x" or "y".
\\ Escapes a special character to treat it literally (e.g., `\*`, `\.`).
\cX Matches a control character.
\0 Matches a NULL character.

Regex Tester

Input Text

Regex Expression

Results

Match Info