RGX-05
Regex Cheatsheet
A searchable quick reference for regex syntax.
Basics
.Any character except newline\dAny digit (0-9)\DAny non-digit\wWord character (letter, digit, underscore)\WNon-word character\sWhitespace character\SNon-whitespace characterAnchors
^Start of string or line$End of string or line\bWord boundary\BNot a word boundaryQuantifiers
*Zero or more of the previous+One or more of the previous?Zero or one of the previous (optional){n}Exactly n times{n,}n or more times{n,m}Between n and m times*?Zero or more, non-greedy (as few as possible)Groups
(...)Capture group(?:...)Non-capturing group(?<name>...)Named capture group(?=...)Positive lookahead(?!...)Negative lookahead(?<=...)Positive lookbehind(?<!...)Negative lookbehindCharacter sets
[abc]Any one of a, b, or c[^abc]Any character except a, b, or c[a-z]Any character from a to zAlternation
a|bEither a or bFlags
gGlobal — find all matches, not just the firstiCase-insensitive matchingmMultiline — ^ and $ match line boundariessDotall — . also matches newlines