R
Regex Master
TutorialsToolsFAQAboutContact

Regex Cheat Sheet

Quick reference guide for all regular expression syntax and metacharacters.

About This Cheat Sheet

This cheat sheet provides a comprehensive overview of regular expression syntax, patterns, and metacharacters. Keep it handy when you're crafting regex patterns or debugging existing ones.

Tip: Bookmark this page and refer to it whenever you need a quick refresher on regex syntax. You can also practice these patterns in our Regex Tester.

Character Classes

PatternDescriptionExample
[abc]Matches a, b, or cMatches "a" in "cat"
[^abc]Matches any except a, b, or cMatches "d" in "dog"
[a-z]Matches any lowercase letterMatches "c" in "Cat"
[A-Z]Matches any uppercase letterMatches "C" in "Cat"
[0-9]Matches any digitMatches "3" in "a3b"
\wMatches word characters (a-z, A-Z, 0-9, _)Matches "a", "3", "_" in "a3_"
\dMatches any digit (same as [0-9])Matches "5" in "x5y"
\sMatches whitespaceMatches space in "hello world"

Quantifiers

PatternDescriptionExample
*Zero or more occurrencesa* matches "", "a", "aa", "aaa"
+One or more occurrencesa+ matches "a", "aa", "aaa"
?Zero or one occurrencea? matches "" or "a"
{n}Exactly n occurrencesa{3} matches "aaa"
{n,m}Between n and m occurrencesa{2,4} matches "aa", "aaa", "aaaa"
{n,}n or more occurrencesa{2,} matches "aa", "aaa", "aaaa"

Anchors

PatternDescriptionExample
^Start of string^hello matches "hello" in "hello world"
$End of stringworld$ matches "world" in "hello world"
\bWord boundary\bcat\b matches "cat" but not "cater"
\BNon-word boundary\Bcat\B matches "cat" in "category"

Special Characters

PatternDescriptionExample
.Any single character (except newline)a.b matches "aab", "abb", "acb"
\|OR operatorcat\|dog matches "cat" or "dog"
(...)Capturing group(cat) matches and captures "cat"
(?:...)Non-capturing group(?:cat) matches "cat" without capturing
\nMatches nth captured group(\w+) \1 matches "word word"

Escape Sequences

PatternDescriptionExample
\\.Escapes special characters\\* matches literal "*"
\\dDigit (0-9)\\d matches "7"
\\DNon-digit\\D matches "a" in "a7"
\\wWord character\\w matches "x" in "x7"
\\WNon-word character\\W matches " " in "hello world"
\\sWhitespace\\s matches space, tab, newline
\\SNon-whitespace\\S matches "h" in " h "
🔥

Popular Patterns

📧

Email Address

Validate standard email formats. Includes support for common domains and subdomains.

Try Email Regex →
📅

Dates (YYYY-MM-DD)

Match dates in ISO 8601 format. Validates year, month, and day structure.

Try Date Regex →
📱

US Phone Number

Match various US phone formats including dashes, dots, and parentheses.

Try Phone Regex →
🌐

IPv4 Address

Validate IPv4 addresses with proper range checking (0-255).

Try IP Regex →
R
Regex Master

Your comprehensive guide to mastering regular expressions through tutorials and tools.

Company

  • About Us
  • Contact
  • FAQ

Resources

  • All Articles
  • Popular Tools
  • Sitemap

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Disclaimer

© 2026 Regex Master. All rights reserved.