Regex Cheatsheet
Searchable regex syntax reference with examples and copy buttons.
About the Regex Cheatsheet
Browse a categorized, searchable reference of regular expression syntax — character classes, anchors, quantifiers, groups, lookaround, and flags — each with an example and a copy button.
Examples
Lookahead
lookaheadOutput
(?=abc) — positive lookaheadKeyboard shortcuts
- Copy the main outputCtrl / ⌘ + Shift + C
- Download the resultCtrl / ⌘ + S
- Share this toolCtrl / ⌘ + Shift + S
- Reset the inputsAlt + R
- Open the tool search paletteCtrl / ⌘ + K
Related tools
Regex Tester
Dev Utilities
Test regular expressions with live match highlighting.
Code Comment Stripper
Dev Utilities
Remove comments from JS, HTML, Python, or SQL source.
Code Screenshot Generator
Dev Utilities
Turn code snippets into shareable syntax-highlighted images.
Line Sorter & Deduper
Dev Utilities
Sort, dedupe, and filter lines with regex include/exclude.
Markdown TOC Generator
Dev Utilities
Build a linked table of contents from Markdown headings.
String Escaper
Dev Utilities
Escape and unescape strings for JSON, JS, HTML, XML, SQL, RegExp, and shell.
Frequently asked questions
Read more
- Writing safer regular expressions: avoiding catastrophic backtracking
ReDoS bugs come from a small number of recognizable patterns. Here's how to spot them and write regexes that stay fast on any input.
- Regex lookahead and lookbehind in practice
What (?=...), (?!...), (?<=...) and (?<!...) actually do, with real patterns for passwords, numbers and text extraction.
- Testing a regex once, then shipping it in JavaScript, Python, Java and Go
Regex syntax is portable in theory and fiddly in practice. Here is how to test a pattern, read its groups, and export a working snippet for seven languages.
Version 1.0.0 · Updated 2026-08-06 · Runs entirely in your browser