DEV Community

Discussion on: JS: Check if an email is valid

Collapse
 
mellen profile image
Matt Ellen-Tsivintzeli

It doesn't completely comply to the RFC, as the RFC allows for comments and the regex does not. As one would expect with a regex.

Collapse
 
andrewbridge profile image
Andrew Bridge

Haha, so even with 321 characters of regex it's not entirely complete.

To be clear, I'm only making the assumption that <input type="email" /> will validate perfectly to the RFC. But I'd rather leave it to a natively supplied tag than write my own either way.

Thread Thread
 
mellen profile image
Matt Ellen-Tsivintzeli • Edited

I agree. The tag is tested by millions of people, everyday, so if there were errors they would pop up.

On the other hand, I don't see the utility of comments in email addresses.



matt (this is a comment 
(with a nested comment) 
which is patently useless)  .ellen@example.com
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
andrewbridge profile image
Andrew Bridge

Someone, somewhere makes heavy use of comments in email addresses I bet. That one person would be positively peeved if we broke their workflow 😆