Regex patterns I actually reuse
A short reference of regular expressions that come up repeatedly in day-to-day scripting.
Common patterns
^\d{3}-\d{3}-\d{4}$ # US phone number
^[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}$ # basic email
^https?:\/\/[^\s]+$ # URL
\b\d{4}-\d{2}-\d{2}\b # ISO date (YYYY-MM-DD)
Non-greedy matching
<.+?> # match the shortest tag content, not the longest
Named groups (Python)
import re
match = re.search(r"(?P<year>\d{4})-(?P<month>\d{2})", "2026-07")
match.group("year") # "2026"