This link has been bookmarked by 73 people . It was first bookmarked on 21 Sep 2007, by Paulo Nogueira.
-
18 Jun 17
kevinoempty
-
01 Oct 14
-
15 Oct 13
-
09 Apr 13
VittyO VittyO"^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~] |(?@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$"
-
16 Nov 12
-
30 Oct 12
-
26 Jan 12
-
28 Sep 11
-
30 Jun 11
Antony Marcano"+" plus signs in emails and other valid but often rejected e-mail address formats...
One of Andy's pet hates (one of mine too) - nice article on it but haven't checked the regex.
This could be a good koan/kata for learning regular expression - or TDD/BDD or both...
Driven with examples:
a@example.com
a.b@example.com
some.more.dots@asite.example.com
user+mailbox@example.comAbc\@def@example.comFred\ Bloggs@example.com"Abc@def"@example.comcustomer/department=shipping@example.com$A12345@example.com!def!xyz%abc@example.com_somename@example.com
ref RFC 3696 -
20 Jun 11
-
16 May 11
Stuart Orford^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~] |(?@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
tech email regex rfc development for:paul_benwell@lifeit.co.uk
-
18 Apr 11
-
17 Apr 11
-
15 Dec 10
-
24 Nov 10
jmarschregex for validating email addresses (it turns out that the rules for a valid SMTP email address are more lenient than one might think)
-
11 Nov 10
-
10 Nov 10
-
19 Sep 10
-
13 Sep 10
-
03 Aug 10
-
20 Mar 10
-
30 Dec 09
andi andersonPhil Haack attempts to infuse technology and software development with humor and a pragmatic eye... Attempts.
-
09 Dec 09
-
31 Jul 09
Phil Haack attempts to infuse technology and software development with humor and a pragmatic eye... Attempts.
email regex validation programming rfc standards regexp development
-
16 Sep 08
-
25 Feb 08
-
14 Feb 08
-
31 Oct 07
-
24 Oct 07
-
21 Sep 07
-
I Knew How To Validate An Email Address Until I Read The RFC<!-- /info --> It seems regular expressions come up a lot when someone mentions validating email addresses. Curiously, and just as incorrect in my opinion, regex are also mentioned in the same sentence as parsing HTML. Notice the parsing bit, but that's not the topic of this post.
I've presented on the topic of regular expressions a number of times at usergroups and I always put up a slide showing this regex. It's the regex used by the Perl module Mail::RFC822::Address and it's nasty.
My problem with validating email addresses is even though it conforms to the spec does not mean it's an active, valid address and worse may not even belong to the user.
So it seems we'd want to:
1. Catch simple mistakes to make a better user experience.
2. Have a valid email address that can be used.
3. Make sure the email belongs to the user.
So how do we do that?
1. We could use a simple regex that's not too restrictive to make sure it generally looks like an email address (something @ something probably with a .) We could also make the user type their email address twice, verifying it the same way we would make them verify their password. A quick check on equality either means they didn't make a mistake, they consistently make that mistake in which case this hasn't helped us, or they copied and pasted it.
2. We could use a really nasty regex. We could shoot off an external process that tries to verify the email address through the mail server of its domain. We could send some url with a hash and have the user confirm their email. An ongoing part of this solution might also be to cull through bounce mail from the server and invalidate the address.
3. I really don't know how else to do this besides mailing the user something and requiring them to do something based on the contents of the email. This is the option from #2 above with the email containing a url and some hash. Do this every time you get a new email address and you should be fairly confident that you can send email address to the user.
My thought on this whole thing is: Why collect the data if you're not going to use it; and why just guess at it's validity when you could confirm it through user action?
-
-
29 Aug 07
-
25 Aug 07
-
22 Aug 07
-
21 Aug 07
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.