<story><title>Stop validating email addresses with your complex regex</title><url>http://davidcelis.com/blog/2012/09/06/stop-validating-email-addresses-with-regex/</url></story><parent_chain><item><author>justincormack</author><text>There used to be someone who had the email address john@dk (maybe it wasnt john). Mx records on tlds are frowned upon but not technically invalid.</text></item><item><author>imperialWicket</author><text>This technique is hinted about, and I don&apos;t claim it as my own creation. I think the easiest (maybe not the best) route for both devs and users is:&lt;p&gt;[submit]&lt;p&gt;does email address have a &apos;@&apos; and a &apos;.&apos; after that?&lt;p&gt;yes -&amp;#62; send a validation email.&lt;p&gt;no -&amp;#62; Hey there, [email] seems like an odd address, are you sure?&lt;p&gt;&lt;pre&gt;&lt;code&gt;       yes -&amp;#62; send a validation email.

       no -&amp;#62; restart
&lt;/code&gt;&lt;/pre&gt;
I think this does a reasonable job of staying out of everyone&apos;s way, and it catches a large percentage of the actual typographical/user error email entries.&lt;p&gt;[formatting edit]</text></item></parent_chain><comment><author>imperialWicket</author><text>This is precisely the reason why you let the user bypass your check with a confirmation. It&apos;s likely that most of your users who enter something without a period made a mistake. If someone is using an address like &apos;john@dk&apos;, I think they&apos;d expect a message saying &apos;your email is invalid&apos;; and seeing a message that just says, &apos;are you sure?&apos; with a &apos;yes&apos; option would be perfectly acceptable.&lt;p&gt;Edit: sorry for the echo, bigiain - I saw your post right after adding the comment.</text></comment>
<story><title>Stop validating email addresses with your complex regex</title><url>http://davidcelis.com/blog/2012/09/06/stop-validating-email-addresses-with-regex/</url></story><parent_chain><item><author>justincormack</author><text>There used to be someone who had the email address john@dk (maybe it wasnt john). Mx records on tlds are frowned upon but not technically invalid.</text></item><item><author>imperialWicket</author><text>This technique is hinted about, and I don&apos;t claim it as my own creation. I think the easiest (maybe not the best) route for both devs and users is:&lt;p&gt;[submit]&lt;p&gt;does email address have a &apos;@&apos; and a &apos;.&apos; after that?&lt;p&gt;yes -&amp;#62; send a validation email.&lt;p&gt;no -&amp;#62; Hey there, [email] seems like an odd address, are you sure?&lt;p&gt;&lt;pre&gt;&lt;code&gt;       yes -&amp;#62; send a validation email.

       no -&amp;#62; restart
&lt;/code&gt;&lt;/pre&gt;
I think this does a reasonable job of staying out of everyone&apos;s way, and it catches a large percentage of the actual typographical/user error email entries.&lt;p&gt;[formatting edit]</text></item></parent_chain><comment><author>bigiain</author><text>imperialWicket&apos;s approach would still work fine in that case when john@dk clicks the &quot;Yes, that&apos;s really my email adress&quot; button - and I suspect he&apos;d be pleasantly surprised to see it work, I&apos;ll bet he&apos;s got a very high expectation of that address failing completely on most websites...&lt;p&gt;I have a cow-orker who&apos;s first name is &quot;G&quot; - he&apos;s very used to poorly-validating websites claiming that his firstname is &quot;wrong&quot;.</text></comment>