Free · Fast · Privacy-first

Regex Cheatsheet — Common Patterns and What They Mean

A comprehensive regex cheatsheet for developers at any level. Each section covers a category of common patterns — anchors, character classes, quantifiers, groups, and real-world patterns for email, URL, phone, and date matching — with clear explanations and examples you can test live in the Regex Tester.

Cost
Free forever
Sign-up
Not required
Processing
In your browser
Privacy
Files stay local

Covers anchors, quantifiers, groups, and character classes

🔒

Real-world patterns with plain-English explanations

Click any pattern to test it live in the tester

Developer Tool

Regex Tester

All processing happens in your browser — your files are never uploaded to any server.

🚀Open Regex Tester

100% Free · No account · Works on any device

How to use this tool

💡

Browse the cheatsheet below, then click any pattern to load it into the Regex Tester and test it against your own data.

How It Works

Step-by-step guide to regex cheatsheet — common patterns and what they mean:

  1. 1

    Anchors: ^ and $

    ^ matches the start of a string (or line with the m flag). $ matches the end. Use them together — ^pattern$ — to match an entire string rather than a substring.

  2. 2

    Character classes: [abc] and \d \w \s

    [abc] matches any one of a, b, or c. \d matches any digit (0–9). \w matches word characters (letters, digits, underscore). \s matches whitespace. Their uppercase inverses (\D, \W, \S) match the complement.

  3. 3

    Quantifiers: *, +, ?, {n,m}

    * means zero or more. + means one or more. ? means zero or one (optional). {n} means exactly n times. {n,m} means between n and m times. Add ? after any quantifier (e.g. *?) to make it lazy (match as few as possible).

  4. 4

    Groups: () and (?:)

    (abc) captures a group and lets you reference it with \1 or in replace strings. (?:abc) groups without capturing — useful when you need grouping for alternation or quantifiers but do not need the value.

  5. 5

    Lookahead and lookbehind

    (?=...) is a positive lookahead — matches a position followed by the pattern. (?!...) is a negative lookahead. (?<=...) is a positive lookbehind. (?<!...) is a negative lookbehind. These do not consume characters.

Frequently asked questions

6 questions

Related guides

More use-case guides for the same tool:

Ready to get started?

Open the full Regex Tester — free, no account needed, works on any device.

Open Regex Tester

Free · No account needed · Works on any device