Hacker News new | ask | show | jobs
by jwilk 3598 days ago
Yes, the are valid e-mail addresses that contain whitespace or multiple @s.

Wikipedia <https://en.wikipedia.org/wiki/Email_address#Valid_email_addr... > gives the following example:

    "very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
3 comments

Exactly. It is very much our nature as programmers to attempt to capture this seemingly trivial bit of structured text into seemingly innocuous programming rules, but the rewards of the added complexity are just too meager. Even if an email address validates, it still doesn't mean that you have a working email address. Sending an email is the only way to be sure, and if you are already doing that, then why risk excluding valid email addresses with a decidedly non-trivial regex?

There are regexes out there that capture all the complexity of valid email addresses today (but who knows if they'll work with, say, next year's additions to the top-level domains?), and you can copy them from StackOverflow if you really want them; but why bother?

It is safe in almost all applications to assume that quoted-string local-parts do not constitute a valid email address (ditto for domain literals).
Oh my.

Nevermind. `/.+@.+/` it is.