I quit shortly thereafter.
I quit shortly thereafter.
> This requirement is a willful violation of RFC 5322, which defines a syntax for e-mail addresses that is simultaneously too strict (before the "@" character), too vague (after the "@" character), and too lax (allowing comments, whitespace characters, and quoted strings in manners unfamiliar to most users) to be of practical use here.
> The following JavaScript- and Perl-compatible regular expression is an implementation of the above definition.
> /^[a-zA-Z0-9.!#$%&'+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)$/
To quote the DBA Stack Exchange post, "if it's good enough for HTML5, it's probably good enough for you". And if you're using inputs with `type="email"` in HTML5, you already are constraining your emails to that format.
(That said, it sounds like the regular expression you were asked to use was not a good one)
[2] https://html.spec.whatwg.org/multipage/input.html#valid-e-ma...
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]{1,63}(?:\.[a-zA-Z0-9-]{1,63})*$/
Hostnames starting or ending with dashes tend to work in the real world anyway.[1] http://referencesource.microsoft.com/#System.ComponentModel....
https://metacpan.org/source/RJBS/Email-Valid-1.202/lib/Email...
As an exercise, I deconstructed that into the pieces it was built from. Funny times :)