GUIDE深度 · Deep dive

Common Regex: Email, URL, Phone

A perfect email, URL or phone regex barely exists; regex is good for format screening, not proving something exists. Define the rules first (length, allowed characters, country), then write the smallest useful pattern.

更新 2026-10-31 · 公式可核验

Common patterns

Email screen: ^[^\s@]+@[^\s@]+\.[^\s@]+$

URL screen: ^https?://[^\s]+$

China mobile: ^1[3-9]\d{9}$

When not to use regex

Use a parser for HTML/JSON/XML, not regex.

Verify email by sending a message and phone by SMS code.

FAQ

How strict should an email regex be?

Keep it practical; too strict rejects valid addresses, and the real check is a verification email.

Will a URL regex miss cases?

Yes; IDNs, relative paths and brackets can all slip through.

Sources

Related calculators

Regex TesterEnter a regex and test text to see matches, positions and capture groups.

More guides

Regex Flags: g, i, m, sRead guide