Regular Expressions (Regex) | Sheetly Cheat Sheet

Last Updated: November 21, 2025

Regular Expressions (Regex)

Pattern matching with regex

🔍 Try it live!

Test your regex patterns in real-time with our Interactive Regex Tester

Basic Syntax

Item Description
. Any single character
^ Start of string
$ End of string
* 0 or more times
+ 1 or more times
? 0 or 1 time (optional)
{n} Exactly n times
{n,m} Between n and m times
[abc] Any of a, b, or c
[^abc] Not a, b, or c

Character Classes

Item Description
\d Any digit [0-9]
\D Not a digit
\w Word character [a-zA-Z0-9_]
\W Not a word character
\s Whitespace (space, tab, newline)
\S Not whitespace
\b Word boundary
\B Not word boundary

Common Patterns

Pattern Regex Matches
Email ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ user@example.com
Phone (US) ^\d{3}-\d{3}-\d{4}$ 123-456-7890
URL ^https?://[\w.-]+\.[a-z]{2,}$ https://example.com
Hex Color ^#[0-9A-Fa-f]{6}$ #FF5733
IP Address ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$ 192.168.1.1
Date (YYYY-MM-DD) ^\d{4}-\d{2}-\d{2}$ 2024-01-15

Groups & Lookahead

Item Description
(abc) Capture group
(?:abc) Non-capturing group
(?=abc) Positive lookahead
(?!abc) Negative lookahead
a|b Match a or b
\1 Backreference to group 1

💡 Pro Tips

Quick Reference

Master text pattern matching

← Back to Web Frameworks | Browse all categories | View all cheat sheets