(?:abc) - Non-capturing group, matches βabcβ without storing it for backreferences
[abc] - Character set, matches βaβ, βbβ, or βcβ
[^abc] - Negated character set, matches any character except βaβ, βbβ, or βcβ
[a-z] - Character range, matches any lowercase letter from a to z
[A-Z] - Matches any uppercase letter from A to Z
[0-9] - Matches any digit from 0 to 9
[a-zA-Z0-9_] - Matches any alphanumeric character or underscore
(a|b) - Alternation, matches either βaβ or βbβ (OR operator)
Special Characters
\\ - Escape character (e.g., \. to match a period)
\n - Newline
\t - Tab
\r - Carriage return
\f - Form feed
\v - Vertical tab
Lookahead and Lookbehind
(?=...) - Positive lookahead, matches if ... follows (e.g., \d(?=abc) matches a digit followed by βabcβ)
(?!...) - Negative lookahead, matches if ... does not follow (e.g., \d(?!abc) matches a digit not followed by βabcβ)
(?<=...) - Positive lookbehind, matches if ... precedes (e.g., (?<=abc)\d matches a digit preceded by βabcβ)
(?<!...) - Negative lookbehind, matches if ... does not precede (e.g., (?<!abc)\d matches a digit not preceded by βabcβ)
Backreferences
\1, \2, etc. - Matches the same text as the first, second, etc., capturing group (e.g., (\w)\1 matches repeated word characters like βaaβ or βbbβ)
Named Capturing Groups: (?<name>...) - Assigns a name to a capturing group (e.g., (?<digit>\d))
Named Backreference: \k<name> - Refers to a named capturing group (e.g., \k<digit>)
Useful Shorthands
.* - Matches any character (except newline) 0 or more times
\w+ - Matches one or more word characters
\d{n} - Matches exactly n digits
\s* - Matches zero or more whitespace characters
[a-zA-Z]+ - Matches one or more alphabetic characters
[A-Za-z0-9_.+-] - Matches characters commonly used in email addresses