πŸ”RegexLab
πŸ§°πŸ“
2026-07-08Β·4 min read

Regex Cheatsheet: Quick Reference Guide

A handy reference for all regex syntax elements with examples.

Regex Cheatsheet

Character Classes

    • [abc] β€” Any of a, b, or c
    • [^abc] β€” Not a, b, or c
    • [a-z] β€” Any lowercase letter
    • [A-Za-z] β€” Any letter
    • \d β€” Digit [0-9]
    • \D β€” Non-digit
    • \w β€” Word character [a-zA-Z0-9_]
    • \W β€” Non-word character
    • \s β€” Whitespace
    • \S β€” Non-whitespace
    • . β€” Any character

Quantifiers

    • * β€” 0 or more
    • + β€” 1 or more
    • ? β€” 0 or 1
    • {n} β€” Exactly n
    • {n,} β€” n or more
    • {n,m} β€” Between n and m

Anchors

    • ^ β€” Start of string
    • $ β€” End of string
    • \b β€” Word boundary
    • \B β€” Non-word boundary

Groups

    • (abc) β€” Capturing group
    • (?:abc) β€” Non-capturing group
    • (?=abc) β€” Lookahead
    • (?!abc) β€” Negative lookahead

Escaping

Escape these special chars: . * + ? ^ $ { } [ ] ( ) | \

Save this page and use our Regex Tester for practice!