Back to tools list
Developer

Regex Memo - Regular Expression Cheat Sheet

Quick reference cheat sheet for Regular Expression syntax.

Special Characters

.Any character (except newline)
\dDigit [0-9]
\DNon-digit
\wWord character [a-zA-Z0-9_]
\WNon-word character
\sWhitespace
\SNon-whitespace
\bWord boundary

Quantifiers

*0 or more times
+1 or more times
?0 or 1 time
{n}Exactly n times
{n,}At least n times
{n,m}Between n and m times
*?0+ times (lazy)
+?1+ times (lazy)

Anchors & Groups

^Start of string
$End of string
(abc)Capture group
(?:abc)Non-capturing group
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind

Character Classes

[abc]a, b, or c
[^abc]Not a, b, or c
[a-z]From a to z
[A-Z]From A to Z
[0-9]From 0 to 9
a|ba or b

Flags

gGlobal — find all matches
iCase-insensitive
mMultiline
sDotall (. matches newline)
uUnicode

Common Patterns

^[\w.-]+@[\w.-]+\.\w{2,}$Email
^https?://[\w.-]+(?:/[\w.-]*)*$URL
^\d{1,3}(\.\d{1,3}){3}$IPv4
^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$Hex Color
^\d{4}-\d{2}-\d{2}$Date (YYYY-MM-DD)

Need a Custom Tool?

Contact us for a consultation and to develop a tailored tool for your business needs.

Contact Us