Download Cheat sheet PDF 12 pages · syntax, editors, patterns, Unicode, performance, debugging
Guide

Regex guides

Long-form guides covering regex fundamentals, performance, language-specific deep dives, and validation patterns. Read in any order.

Regex fundamentals

Learn regular expressions from scratch — character classes, quantifiers, anchors, groups, and your first pattern.

Anchors — ^ $ \b explained

How anchors work in regex: start of string, end of string, word boundary, and how multiline mode changes them.

Quantifiers — greedy vs lazy

How *, +, ?, {n}, and their lazy versions work, with practical examples.

Character classes

Square bracket classes, shorthand classes (\d \w \s), and Unicode property escapes.

Lookarounds — assertions explained

Positive and negative lookahead and lookbehind, with real examples.

Common regex mistakes

The most frequent regex pitfalls and how to avoid them.

Regex performance & ReDoS

Why some patterns are slow, what catastrophic backtracking is, and how to fix it.

Regex in Python

Complete guide to Python's re module: compile, match, search, findall, sub, named groups, verbose mode.

Regex in JavaScript

Modern JavaScript regex: RegExp, named groups, lookbehind, Unicode property escapes, sticky flag.

Regex flags reference

Every regex flag explained: g, i, m, s, u, x, y, d. With examples and language-specific notes.

Validation patterns

When to validate with regex, when to use a parser instead. Battle-tested patterns for the common fields.

Regex substitution

Search and replace with back-references, named groups, function replacements, across all the major engines.

Capture groups — every kind

Capturing, non-capturing, named, atomic — when to use each.

Validating Indian IDs

Aadhaar, PAN, GSTIN, UPI, IFSC — complete guide with checksum notes.

Converting flavors

Porting regex between Python, JavaScript, PCRE, Java, .NET, Go, Ruby.

Groups and capture groups

Capture, non-capture, named groups, and back-references.

Escaping special characters

Which characters need escaping and a reference table.

Advanced character classes

POSIX classes, Unicode categories, intersection.

Regex flags deep dive

Every flag: g, i, m, s, u, y, d, x.

Regex in Go

RE2 engine, limitations, and idioms.

Regex in Java

Pattern, Matcher, double-escaping pain.

Regex in C# / .NET

The most feature-rich engine.