A regular expression is a tiny language for finding shapes in text. A handful of symbols covers most jobs.
Basic symbols
\d digit · \w letter, digit or _ · \s whitespace
. any one character · ^ start · $ end
* 0 or more · + 1 or more · ? 0 or 1 · {2,4} 2 to 4 times
[abc] one of these · [^abc] none of these · ( ) group
Common patterns
US phone number — \(?\d{3}\)?[ -]?\d{3}-\d{4}
Email (simple) — [\w.+-]+@[\w-]+\.[\w.]+
Letters only — [A-Za-z]+
Date 2026-11-28 — (\d{4})-(\d{2})-(\d{2})
Be careful
Things with complex rules like email addresses are hard to validate perfectly with a regex. Filter roughly, and confirm for real (for example by sending a mail). Nested repetition like (a+)+ can become extremely slow.