AnkhKit

Regular Expression Cheat Sheet — Free

Runs 100% in your browser — your files never leave your device.

Regular expressions become manageable when the syntax is grouped by purpose instead of memorized as punctuation. Search a concise reference of character classes, boundaries, repetition, grouping, lookarounds, backreferences, and JavaScript-compatible flags, then copy any token.

How it works

  1. 1

    Search a regex concept

  2. 2

    Read the matching syntax

  3. 3

    Copy the token or example

About this tool

The building blocks

Character classes (. \d \w \s and their negations), anchors (^ $ \b), quantifiers (* + ? {n,m}), groups and alternation (( ) |) — the sheet organizes the full token vocabulary by what it matches, with examples you can lift straight into the tester.

The three patterns everyone reuses

Email-ish matching, URL matching, and date matching account for most daily regex. The sheet gives working versions of each — deliberately good-enough rather than RFC-perfect, because the perfect versions are unreadable and the pragmatic ones pass 99.9 percent of real input.

The two traps

Greedy quantifiers eat more than intended — use the lazy variants (*?, +?) when a match should stop early. And test against both matching and non-matching input in the tester: a pattern that only ever sees positives has not been tested.

Frequently asked questions

Why does my regex match too much?

Greedy quantifiers extend to the last possible match. Make them lazy with a trailing ? — .*? stops at the first opportunity instead of the last.

What does \b do?

It matches a word boundary — the invisible line between a word character and anything else. \bcat\b matches "cat" but not "category".

Are all regex flavors the same?

No — JavaScript, Python, and PCRE differ in lookbehind support, flags, and unicode handling. The sheet notes where flavors diverge; test in your target language.

More developer tools