Re:How not to check the validity of an email address
by callahad on Wednesday September 04, 2013 @07:11AM
(#6326707)
The HTML5 standard actually defines a mostly-sane regex, which achieves that sanity through "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."
I like it.
Link: http://www.whatwg.org/specs/web-apps/current-work/multipage/...
Re:How not to check the validity of an email address
by rmc on Wednesday September 04, 2013 @05:48AM
(#6326503)
The RFC-compliant email address is actually incredibly complex. There are loads of things that are RFC-valid email addresses that basically hardly anyone uses (like spaces).
Re:How not to check the validity of an email address
by computer on Wednesday September 04, 2013 @04:33AM
(#6326306)
Just send an email and see if it arrives.
Re:How not to check the validity of an email address
by jabr on Wednesday September 04, 2013 @05:33AM
(#6326463)
/.@./ is pretty much the best you can do.
And even the dots are a bit iffy.
Re:How not to check the validity of an email address
by mason240 on Wednesday September 04, 2013 @09:02AM
(#6327222)
@"^[^@]{1,}[@]{1}[^@]{1,}\.{1}[^@]{1,}$"
I check it with this RegEx to make sure it's in the right format of [string]@[string].[string] to make sure that user at least tries to enter an email address, but beyond that sending and email and getting a response is the only way.
Re:How not to check the validity of an email address
by drdaeman on Wednesday September 04, 2013 @10:35AM
(#6327823)
> @"^[^@]{1,}[@]{1}[^@]{1,}\.{1}[^@]{1,}$"
Is not
> [string]@[string].[string]
It's mere ^.+@.+\..+ (in both POSIX extended and PCRE dialects) that properly represents the latter.
And even such regexp filters out many technically-valid but obscure cases of RFC-compliant email addresses (for example ai, io, kh and ws TLDs have MX records, and supposedly hostmaster@io should be a valid email address).
Re:How not to check the validity of an email address
by neurostimulant on Wednesday September 04, 2013 @12:53PM
(#6328812)
Check out this incredibly complex rfc822 regex in action: http://regex101.com/r/fZ6cD5
If not I may be compelled to create one.