Regular Expressions (Regex) Cheatsheet & Syntax Quick Reference
The complete, interactive Regular Expressions syntax reference with battle-tested patterns for emails, URLs, phones, and UUIDs.
Anchors & Boundaries
Specify where in the line or string a match must occur.
Matches the start of the string, or start of line in multiline mode.
^Matches the end of the string, or end of line in multiline mode.
$Matches the boundary between a word character and a non-word character.
\bMatches any position that is NOT a word boundary.
\BCharacter Classes
Match specific sets of characters.
Matches any single character except newline (unless 's' flag is set).
.Matches any digit (equivalent to [0-9]).
\dMatches any non-digit character (equivalent to [^0-9]).
\DMatches alphanumeric characters plus underscore (equivalent to [a-zA-Z0-9_]).
\wMatches any non-word character.
\WMatches spaces, tabs, line breaks, and form feeds.
\sMatches any character that is not whitespace.
\SMatches any single character in the brackets (a, b, or c).
[abc]Matches any single character NOT in the brackets.
[^abc]Matches any lowercase letter from a to z.
[a-z]Quantifiers
Control how many times an element must repeat.
Matches 0 or more times (greedy).
*Matches 1 or more times (greedy).
+Matches 0 or 1 time (greedy).
?Matches exactly 3 times.
{3}Matches 3 or more times.
{3,}Matches between 2 and 5 times.
{2,5}Matches the minimum possible characters instead of maximum.
*? / +?Common Battle-Tested Patterns
Ready-to-use production regular expressions.
Standard RFC 5322 compliant email validator.
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$Matches valid web URLs with optional path and queries.
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)Matches valid IP addresses from 0.0.0.0 to 255.255.255.255.
^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$Matches valid Version 4 UUID format.
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$Matches 3-digit or 6-digit hex color strings.
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$Matches 10-digit phone numbers in various delimiters.
^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$FAQ
Frequently Asked Questions
What is the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +) match as much text as possible. Appending a question mark (*?, +?) makes them lazy, matching the smallest substring that satisfies the pattern.
How do I test regular expressions in my browser?
You can test any regex in real-time using the MultiToolX Find and Replace Text tool with the Regex toggle enabled.