.*RegexQuick

Regex Cheat Sheet

Quick reference for regex syntax: character classes, quantifiers, anchors, groups, lookaheads, and flags.

//

About this pattern

This cheat sheet covers the most commonly used regex syntax. Character classes: \d (digit), \w (word char), \s (whitespace), . (any char), [abc] (character set), [^abc] (negated set). Quantifiers: * (0+), + (1+), ? (0 or 1), {n} (exactly n), {n,m} (between n and m). Anchors: ^ (start), $ (end), \b (word boundary). Groups: (...) (capture), (?:...) (non-capture), (?=...) (positive lookahead), (?!...) (negative lookahead). Flags: g (global), i (case-insensitive), m (multiline), s (dotAll).

FAQ

What is the difference between * and +?

* matches zero or more occurrences (optional). + matches one or more (required).

When should I use non-capturing groups?

Use (?:...) when you need grouping for alternation or quantifiers but do not need to extract the matched text.

More patterns