Printable Regex Cheat Sheet

Free printable regular-expression cheat sheet at exact scale — the regex syntax you use every day grouped by task: character classes, anchors and boundaries, quantifiers, groups and alternation, lookaround, escapes, flags, replacement references and a set of ready-made common patterns, all on one page.

This regex cheat sheet gathers the metacharacters and constructs that turn up in almost every pattern and groups them by what you’re trying to do — matching classes of characters (\d, \w, \s, custom [a-z] sets), anchoring to the start or end of a line or word, repeating with greedy, lazy and possessive quantifiers, capturing and naming groups, and asserting context with lookahead and lookbehind.

It also covers the flags that change matching (i, g, m, s, x, u), how to reference captures in a replacement string, and a bank of copy-ready patterns for emails, URLs, dates, IPv4 addresses, hex colours, trimming whitespace and finding duplicates. Flavour notes call out where PCRE, JavaScript and Python differ, so it works as a desk reference whichever engine you’re using — and it prints at exact scale in real millimetres on A4, Letter or any size.

Printing at exact scale

Every sheet is drawn in real millimetres and prints at exact physical scale. For accurate output, set Scale = 100% (Actual size) and Margins = None in your browser's print dialog. Not sure your printer is honest? Run the printer ruler test first to confirm 50 mm really measures 50 mm. Prefer a file? Use the PDF, PNG or SVG buttons to download the sheet instead of printing — PDF and SVG keep the exact dimensions, and PNG is a 300 DPI image.

Frequently asked questions

Which regex features are covered?

Character classes, anchors and word boundaries, quantifiers (greedy, lazy, possessive), capturing / non-capturing / named groups, alternation and backreferences, lookahead and lookbehind, escapes and specials, flags/modifiers, replacement references and a set of common ready-to-use patterns.

Which regex flavour is this for?

The core syntax works across most engines. Where behaviour differs, rows are labelled for PCRE (PHP, grep -P), JavaScript and Python — for example \A and \Z, possessive quantifiers, \K, and inline flags.

What’s the difference between greedy, lazy and possessive?

Greedy quantifiers (*, +) match as much as they can, then backtrack; lazy ones (*?, +?) match as little as possible; possessive ones (*+, ++, PCRE) match greedily and never give characters back. The sheet lists all three side by side.

Does it include common patterns like email or date?

Yes — the wide “Common patterns” panel has copy-ready expressions for emails, HTTP/HTTPS URLs, YYYY-MM-DD dates, IPv4 addresses, hex colours, whole words, whitespace trimming, duplicate characters and matching HTML tag pairs. They’re practical starting points, not RFC-perfect validators.

Is it really free?

Yes. Every template on printsheet.io is completely free, with no sign-up, no account and no watermark. Generate as many sheets as you like.

How do I get an exact-scale print?

Choose your paper size, then in the print dialog set Scale to 100% or “Actual size” and Margins to None. The sheet is defined in real millimetres, so it prints at true size. Use the calibration ruler page to verify.

Which paper sizes are supported?

A4, A3, US Letter, Legal and Tabloid, in portrait or landscape. (A5 and A6 are omitted as this dense reference is hard to read that small.) Pick the size that matches the paper loaded in your printer.

Can I save it as a PDF or image?

Yes — choose “Save as PDF” as the printer in your browser's print dialog, or use the PNG and SVG download buttons. PDF and SVG keep the exact millimetre dimensions; PNG is a high-resolution 300 DPI image, ideal for pasting into a document or sharing.