REGEX LAB
PCREGo
QUICK REFERENCE
Anchors
^start of line / string$end of line / string\bword boundary\Bnon-word boundaryCharacters
.any char (s flag: incl. \n)\d / \Ddigit / non-digit\w / \Wword char / non-word\s / \Swhitespace / non-ws[abc]character class[^abc]negated class[a-z]rangeQuantifiers
* + ?0+, 1+, 0-1 (greedy){n}exactly n{n,m}n to m (greedy)*? +? ??lazy (non-greedy)Groups
(abc)capture group(?:abc)non-capturing(?P<n>abc)named captureLookaround · PCRE
(?=abc)positive lookahead(?!abc)negative lookahead(?<=abc)positive lookbehind(?<!abc)negative lookbehindBackrefs · PCRE
\1 \2backref in pattern$1 $2backref in replace${name}named group in replace//
PCRE-compatible engine (regexp2/v2) — backreferences, lookahead/lookbehind, atomic groups, Unicode. Flags: i=case-insensitive m=multiline s=dot-matches-newline.