Regular Expressions (Regex) Cheat Sheet

A quick reference for common Regular Expression (Regex) patterns.

PatternDescription
.Any single character.
\dAny digit (0-9).
\wAny word character (alphanumeric & underscore).
\sAny whitespace character.
^Start of the string.
$End of the string.

PatternDescription
*Zero or more occurrences.
+One or more occurrences.
?Zero or one occurrence.
{n}Exactly n occurrences.
{n,}n or more occurrences.
{n,m}Between n and m occurrences.

PatternDescription
[abc]A single character of: a, b, or c.
[^abc]A character that is not: a, b, or c.
[a-z]A character in the range: a-z.
[a-zA-Z]A character in the range: a-z or A-Z.