Validates that a string follows a standard email format: local part, @ symbol, domain, and TLD.
3/7
matches
/^[\w.-]+@[\w.-]+\.\w{2,}$/i
^ — Start of string
[\w.-]+ — One or more word chars, dots, or hyphens (local part)
@ — Literal @ symbol
[\w.-]+ — Domain name
\. — Literal dot before TLD
\w{2,} — TLD with 2+ characters
$ — End of string
This is a basic email regex. For production use, consider RFC 5322 compliance or use a dedicated email validation library.