Regex Pattern Library
A searchable library of common, ready-to-copy regex patterns (email, URL, IP address, dates, passwords and more) with plain-English explanations.
This guide is not yet available in your language and is shown in English.
Tool guide
What this tool does
Regex Pattern Library is a searchable reference of commonly needed regular expressions, email addresses, URLs, IP addresses, dates, phone numbers, passwords and more, each with a plain-English explanation and a one-click copy button.
Reaching for a regular expression for something common, validating an email format, matching a hex colour, checking a date format, usually means either writing it from scratch (and getting edge cases wrong) or digging through old code or forum answers to find one that already works.
This library collects commonly needed patterns across contact info, the web, networking, dates, numbers and more, each with a plain-English explanation of exactly what it matches (and importantly, what it doesn’t), searchable by name, category or content, with a one-click copy button for dropping straight into your code.
How to use Regex Pattern Library
- Search by keyword (e.g. "email", "date", "password") or browse by Category.
- Read each pattern’s plain-English explanation to confirm it matches what you need.
- Press Copy to copy the raw pattern to your clipboard.
- Paste it into your code, or into the Regex Tester to try it against your own sample text.
Tips for better results
- Read the explanation carefully before using a pattern in production; several (like the simple email or credit card patterns) are intentionally basic and noted as such, since a fully correct real-world version is often more complex than is practical to hand-write.
- Test any copied pattern against your own real sample data in the Regex Tester before relying on it, since edge cases in your specific data can differ from the examples here.
- The password-strength pattern uses lookaheads, a technique worth understanding on its own, since it’s one of the more advanced constructs commonly needed in real validation rules.
- For anything parsing HTML, prefer a real HTML parser over the HTML tag regex here; regex is fundamentally unreliable for nested or malformed markup.
Common use cases
- Quickly grabbing a working starting-point pattern for a form validation field.
- Learning what a specific common pattern (like IPv4 or slug validation) actually looks like and why it’s structured that way.
- Comparing a pattern you’ve written against a reference version to spot what you might be missing.
- Teaching or demonstrating common regex use cases with ready explanations.
Common mistakes to avoid
- Using the simplified email or credit card patterns as a strict source-of-truth validator in a context where correctness really matters; a dedicated checksum validator (like the Credit Card Validator) or a well-tested library is more reliable for anything beyond basic format checking.
- Copying a pattern without reading its explanation, then being surprised when it doesn’t handle an edge case it was never designed for (like the basic IPv6 pattern not handling :: compression).
- Using the HTML tag regex for real HTML parsing; it only reliably handles simple, non-nested tags.
Frequently asked questions
Are these patterns production-ready?
Most are solid starting points for common cases, but several (noted in their descriptions) are intentionally simplified; always test against your own real data and consider a dedicated library for anything security- or correctness-critical.
Can I test these patterns before using them?
Yes, copy any pattern and paste it into the Regex Tester to try it against your own sample text with live match highlighting.
Why isn’t there a pattern for X?
This library covers the most commonly needed patterns across contact info, web, networking, dates and text; for anything more specialised, the Regex Explainer can help you understand and build your own.
What regex flavour are these written for?
JavaScript’s RegExp syntax, though most patterns here use widely portable constructs that also work in Python, PCRE and most other common regex flavours with little or no change.
Related articles
Feedback & suggestions
Help us improve Regex Pattern Library. We read every message.