Regex Interactive Cheat Sheet
High-performance regular expression reference guide for elite developers
Character Classes
Quantifiers
Anchors & Logic
Lookarounds
Pro Tip: Click to Copy
Click any regex token in the list above to instantly copy it to your clipboard for use in our advanced tester.
A compact regular expression reference you can copy from
Regular expressions are easy to forget between uses. Was the negative lookbehind written with a question mark and a less-than sign, or the other way around? This page is a short reference grouped into four cards, and every token is clickable so you can copy it instead of retyping it. It is meant to sit in a browser tab next to your editor or one of the other regex tools while you build a pattern.
How to use the sheet
- Scan the four cards: Character Classes, Quantifiers, Anchors & Logic and Lookarounds.
- Read the short description on the right of each row to confirm it does what you need.
- Click the red token itself. It is copied to your clipboard.
- Paste it into your pattern field in the Regex Tester, your code editor or wherever you are working.
What each card covers
Character Classes lists the dot (any character except a newline), the digit shorthand, the word-character shorthand, the whitespace shorthand and square-bracket ranges such as a to z. Quantifiers explains star, plus and question mark, plus the exact-count and range forms written with curly braces. Anchors & Logic covers the caret and dollar sign for line boundaries, the word boundary, the pipe for alternation, and the non-capturing group. Lookarounds shows positive and negative lookahead and lookbehind.
Situations where it helps
- Writing a validation pattern and checking whether you need a word boundary or a line anchor.
- Reviewing a colleague's pattern and decoding an unfamiliar token like a non-capturing group.
- Learning regex for the first time and needing a short list rather than a full manual.
- Building a find-and-replace for a log file and copying the lookahead syntax exactly.
Things to keep in mind
This is a deliberately short list of the most common building blocks, not a complete specification. It does not include escapes such as tab or newline, Unicode property classes, named groups, backreferences or lazy quantifiers, so consult your language's documentation for those. Regex engines also differ: lookbehind support and syntax vary between JavaScript, PCRE (used by PHP), Python and Java, and older engines may lack it entirely.
When the token is copied it goes to the clipboard only; the page shows no editor of its own. To try a pattern against sample text, paste it into the Regex Tester and run it there. Remember that when you place a pattern inside a string literal in code, backslashes usually need doubling, so the digit shorthand becomes two backslashes and a d in many languages.
Related Tools
Related Tools