📖

Regex Cheatsheet

Quick regular expression reference

Character Classes

\dDigit (0-9)
\wWord char (a-z, A-Z, 0-9, _)
\sWhitespace
.Any character
[abc]a, b, or c
[^abc]Not a, b, or c

Quantifiers

*0 or more
+1 or more
?0 or 1
{3}Exactly 3
{3,}3 or more
{3,5}3, 4, or 5

Anchors

^Start of string
$End of string
\bWord boundary

Common Patterns

\d{3}-\d{3}-\d{4}
Phone: 123-456-7890
^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$
Email validation