10 Practical Regex Patterns Every Engineer Should Bookmark (2026 Playbook)
10 copy-paste regex patterns + JavaScript/Go/Python snippets: Chinese mobile + ID card, UUID v4/v7, ISO 8601 timestamps, email RFC 5322 strict, CSV row parser, Base64 detector, Markdown link extractor, SemVer, 信用卡 Luhn pre-check, password strength. All live-tested against Korelyy Regex Tester with explanation trees.
1. Quick Reference: 10 Patterns With Explanations
#1 中国移动号码 (精确 2024-号段)
/^1(3[0-9]|4[014-9]|5[0-3,5-9]|6[2567]|7[0-8]|8[0-9]|9[0-3,5-9])\d{8}$/
#2 UUID v4
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/
#3 UUID v7
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-7[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/
#4 RFC 5322 "strict" email (usable in production)
/^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/
#5 ISO 8601 timestamp (with Z or offset)
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,6})?(Z|[+-]\d{2}:\d{2})$/
#6 Semantic Versioning (https://semver.org)
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
#7 18-digit Chinese ID Card (GB11643-1999 checksum stage-1 regex, please validate checksum separately)
/^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[0-9Xx]$/
#8 Base64 headerless blob detector
/^[A-Za-z0-9+/]{4}*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
#9 Extract Markdown links: group 1 = label, group 2 = href
/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g
#10 Password strength (min 12 chars + upper + lower + digit + symbol)
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]).{12,128}$/2. Anti-Patterns: 3 Regex Mistakes That Blew Up Production
FAQ: Frequently Asked Questions
What are the most useful regex patterns?
Top patterns: email validation, phone numbers, URLs, date formats, IP addresses, hex colors, credit cards, HTML tags.
How do I test regex patterns?
Use Korelyy's Regex Tester with live matching, highlighting, and group display in real-time.
What regex flavor should I use?
JavaScript/ECMAScript for web development — most common and compatible with Node.js, browsers, and text editors.