Tools
Regex
Pattern matching — anchors, classes, quantifiers, groups.
Character classes
.Any char except newline\d \DDigit / non-digit\w \WWord char / non-word\s \SWhitespace / non-ws[abc]a, b, or c[^abc]Not a, b, or c[a-z]RangeAnchors
^Start of line$End of line\bWord boundary\BNon-boundaryQuantifiers
*0 or more+1 or more?0 or 1{3}Exactly 3{2,5}Between 2 and 5{2,}2 or more*?Lazy (non-greedy)Groups & lookaround
(abc)Capture group(?:abc)Non-capturing(?<name>x)Named groupa|bAlternation(?=x)Positive lookahead(?!x)Negative lookahead(?<=x)Positive lookbehindCommon patterns
# email (simple)
^[\w.+-]+@[\w-]+\.[\w.-]+$
# URL
https?://[^\s]+
# IPv4
\b(\d{1,3}\.){3}\d{1,3}\b
# strip HTML tags
<[^>]+>