Quick reference for regular expressions (similar across JavaScript, Python re, PCRE, grep -E).

Anchors & boundaries

^     start of line (or string, depending on engine)
$     end of line
\b    word boundary
\B    not a word boundary

Character classes

[abc]      a, b, or c
[a-z]      lowercase letter
[^0-9]     not a digit
\d \D      digit / non-digit
\w \W      word char / non-word (often [A-Za-z0-9_])
\s \S      whitespace / non-whitespace
.          any char except newline (unless DOTALL)

Quantifiers

*  +  ?    zero+, one+, zero or one
{n} {n,} {n,m}   exact, n+, between n and m
*? +? ??   lazy (non-greedy) variants

Groups & alternation

(foo|bar)       capture group
(?:foo)         non-capturing
\1 \2           backreference (numbered)
(?<name>...)    named group (where supported)

Lookaround (if supported)

(?=...)   positive lookahead
(?!...)   negative lookahead
(?<=...)  positive lookbehind
(?<!...)  negative lookbehind

Copy-paste examples

Email (simple):     [\w.+-]+@[\w-]+\.[\w.-]+
IPv4:               \b(?:\d{1,3}\.){3}\d{1,3}\b
UUID v4:            \b[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\b
Slug:               \b[a-z0-9]+(?:-[a-z0-9]+)*\b

Always test on real data; email/HTML/URL validation often needs smarter rules than a single regex.