Regex Quick Reference
A comprehensive regex syntax reference covering character classes, anchors, quantifiers, groups, backreferences, lookahead/lookbehind, and flags. Searchable and categorized for quick lookup. Includes examples for each pattern.
Character Classes
.Any character except \n\dDigit [0-9]\DNot a digit\wWord char [a-zA-Z0-9_]\WNot a word char\sWhitespace\SNot whitespace[abc]a, b, or c[^abc]Not a, b, or c[a-z]Range a to zAnchors
^Start of string/line$End of string/line\bWord boundary\BNot word boundaryQuantifiers
*0 or more+1 or more?0 or 1{n}Exactly n{n,}n or more{n,m}Between n and mGroups & Lookaround
(abc)Capture group(?:abc)Non-capture group(?<name>abc)Named group\1Back-reference(?=abc)Positive lookahead(?!abc)Negative lookahead(?<=abc)Positive lookbehind(?<!abc)Negative lookbehindFlags
gGlobal — all matchesiCase-insensitivemMultiline (^ $ per line)sDotall (. matches \n)uUnicodeyStickySpecial Characters
\nNewline\rCarriage return\tTab\\Backslash\.Literal dot\|Literal pipe