Regex Cheatsheet
A comprehensive reference guide for regular expressions. Use this to quickly look up syntax, character classes, and complex groupings.
Character Classes
Anchors
Beginning
Matches the beginning of the string, or the beginning of a line if the multiline flag (m) is enabled.
End
Matches the end of the string, or the end of a line if the multiline flag (m) is enabled.
Word boundary
Matches a word boundary position between a word character and non-word character or position (start / end of string).
Groups & Lookarounds
Capture group
Groups multiple tokens together and creates a capture group for extracting a substring or using a backreference.
Named capture group
Creates a capturing group that can be referenced via the specified name.
Positive lookahead
Matches a group after the main expression without including it in the result.
Positive lookbehind
Matches a group before the main expression without including it in the result.
Quantifiers
Quantifier
Matches the specified quantity of the previous token. {1,3} will match 1 to 3. {3} will match exactly 3. {3,} will match 3 or more.
Lazy
Makes the preceding quantifier lazy, causing it to match as few characters as possible.