Common Regex Library (Email, URL, IP, Phone, Date)
Stop reinventing the email regex (and getting it wrong). This library has battle-tested patterns for the things you actually need to validate — email, URL, IP addresses, phone numbers, dates, credit cards, ISBN, hex colors — with example matches and copy-paste-ready syntax for JavaScript, Python, PCRE, and POSIX flavors.
How to use the Common Regex Library (Email, URL, IP, Phone, Date)
Search by keyword (email, url, ip, date, currency). Click Copy on any pattern to copy it. The "test" input runs your string against every visible pattern — green badge if it matches, gray if not.
What makes a stock regex trustworthy?
Most regexes you copy off a forum are either too loose — an "email" check that happily accepts a@b — or too strict, rejecting valid addresses that contain a + tag or a newer TLD. The patterns in this library are chosen for predictable behaviour, not theoretical perfection.
A fully RFC 5322-compliant email regex runs to hundreds of characters and still cannot prove a mailbox exists. The pragmatic pattern here matches the real addresses you actually meet and rejects obvious garbage, which is all a regex can honestly do. Every entry notes where it trades completeness for clarity, so you know its limits before you ship it.
Common use cases
- Form validation — drop in an email, phone, or postcode check without writing one from scratch.
- Log and text mining — pull every IP, URL, or timestamp out of a wall of log output.
- Data cleaning — flag rows whose fields do not match the expected shape before an import.
- Editor find-and-replace — paste a pattern straight into VS Code, Sublime, or ripgrep for bulk edits.
- Checking your own work — compare a regex you wrote against a reference that is known to behave.
Frequently asked questions
Is there a single "correct" email regex?
Which flavor are these patterns written in?
Why is the IPv4 pattern longer than <code>\d{1,3}</code> repeated four times?
\d{1,3} also matches 999 and 256, which are not valid octets. A correct pattern bounds each octet to 0–255 with alternation such as 25[0-5]|2[0-4]\d|1?\d?\d.