Regex Cheatsheet & Tester
Interactive regex reference with search, categories, and a live pattern tester. Copy tokens instantly and test patterns in your browser.
Updated
What is the Regex Cheatsheet & Tester?
The Regex Cheatsheet & Tester gives you instant access to over 50 essential regular expression tokens — from anchors and character classes to lookaheads and flags. No more switching between documentation tabs or reading dense PDFs.
Why this tool?
- Live search & filter: start typing and the cheatsheet narrows down instantly. Filter by category (Anchors, Quantifiers, Groups, Flags, etc.) with a single click.
- Copy any token with one tap – no manual highlighting, just hit the copy button.
- Built‑in pattern tester: paste your own regex, add flags, and run it against a test string. See every match, its position, and named group values — all client‑side, nothing leaves your browser.
- Clean, responsive design that works just as well on a phone as on a desktop.
Whether you’re debugging a complex pattern or learning regular expressions from scratch, this tool keeps the entire JavaScript/PCRE‑compatible syntax at your fingertips.
How it works
1. Browse or search the cheatsheet
The entire reference is organized into logical categories (Anchors, Character Classes, Quantifiers, Groups, Lookarounds, Escaped Characters, Flags, and Common Patterns).
- Search field – Type any keyword (e.g. “boundary”, “email”, “lookbehind”) to instantly filter matching tokens, descriptions, and examples.
- Category dropdown – Pick a specific category or leave it on “All” to see everything.
Each token card shows:
- The regex symbol(s) in a monospaced code block.
- A short, plain‑English explanation.
- An optional example (e.g.
\d+→ matches “123”). - A copy button that puts the token directly onto your clipboard.
2. Test your own patterns
Below the cheatsheet, a live regex tester lets you experiment:
- Enter a pattern (e.g.
\d{3}-\d{2}-\d{4}). - Set optional flags –
gfor global,ifor case‑insensitive,mfor multiline,sfor dotall,ufor Unicode,yfor sticky. Multiple flags are allowed (e.g.gi). - Type or paste a test string.
- Click Run Test.
The result area shows:
- The total number of matches.
- Each match surrounded by quotes, preceded by its starting index.
- Any named groups (e.g.
(?<year>\d{4})) are displayed asgroupName: "value".
Invalid patterns or unsupported flags trigger a clear, human‑readable error message.
3. Privacy & performance
Everything runs inside your browser. No data is sent to any server. The tool uses native JavaScript RegExp objects, so it’s fast and respects the same engine your production code will use.
Examples
Find an email regex pattern
Type “email” in the search field to instantly locate the common email validation token along with its description and example.
Test a date validation pattern
Paste a regex and a test string to see all matches, their indices, and named groups (if any).
Frequently asked questions
What exactly is a regex cheatsheet?
What exactly is a regex cheatsheet?
A regex (regular expression) cheatsheet is a quick‑reference table of the special characters, sequences, and constructs used to build pattern‑matching expressions. This interactive version adds search, copy, and a built‑in tester so you can experiment without leaving the page.
Which regex flavour does this cheatsheet cover?
Which regex flavour does this cheatsheet cover?
All tokens and the live tester follow JavaScript (ECMAScript 2018+) syntax. That includes lookbehinds, named capture groups, Unicode property escapes (when using the u flag), and the standard PCRE‑like quantifiers and anchors.
How do I use the built‑in tester?
How do I use the built‑in tester?
Scroll to the “Test a Pattern” section. Enter a regex pattern, any flags (e.g. gi), and a test string. Click Run Test. The tool shows every match, its position (index), and any named groups. Invalid patterns or flags are reported immediately.
Can I copy a token to my clipboard?
Can I copy a token to my clipboard?
Yes – every token card has a copy button. Click it once to copy the exact regex symbol(s) (e.g. \b, [a-z], (?<=…)) to your clipboard. No extra selection or manual highlighting is needed.
What common real‑world patterns are included?
What common real‑world patterns are included?
The “Common Patterns” category provides ready‑to‑use expressions for email addresses, URLs, dates (YYYY‑MM‑DD), UUIDs, and international phone numbers. You can copy and adjust them directly in your code.
Is my test data sent to a server?
Is my test data sent to a server?
No. Everything runs entirely inside your browser using JavaScript’s RegExp engine. No patterns, test strings, or results ever leave your device.
Why do I get a “No matches” result even though my pattern looks correct?
Why do I get a “No matches” result even though my pattern looks correct?
Check if the g (global) flag is needed to find multiple matches. Also verify that the pattern accounts for the entire string or partial match logic. Use the tester’s index output to debug where a match might be starting.
Can I use lookbehinds and named groups?
Can I use lookbehinds and named groups?
Absolutely. The tool supports ES2018+ features including positive/negative lookbehinds ((?<=…) and (?<!…)) and named capturing groups ((?<name>…)). The tester displays named group values when they are defined.
How do I search for a specific token or category?
How do I search for a specific token or category?
Use the search bar at the top of the page – it filters tokens by keyword, description, or example. The category dropdown lets you jump to “Anchors”, “Quantifiers”, “Flags”, etc. instantly.
Is this cheatsheet suitable for beginners?
Is this cheatsheet suitable for beginners?
Yes. Every token includes a clear, plain‑language description and a concrete example. Paired with the interactive tester, it’s a great hands‑on learning tool. Start with simple patterns and build up gradually.
Related tools
More utilities you might find handy.
.env File Generator
Quickly generate clean, properly-quoted .env files from key-value pairs — no more quoting errors or broken deployments.
.htaccess Redirect Builder
Generate error-free Apache .htaccess code for 301 redirects, HTTPS enforcement, and canonical URL routing.
ASCII Converter – Text to ASCII, Hex, Binary & Back
Convert text to ASCII codes and decode back in decimal, hex, binary, or octal — live, private, and 100% browser-based.