Aaron Longnion asked if I could modify the email validation on my blog to allow the + character in email addresses. Apparently in gmail you can add +anything to your email address (after the username and before the @ character) and it will still arrive in your account. This helps people organize emails that come from filling out online forms, or signing up for newsletters, or commenting on blogs or whatever. I went ahead and modified the isEmail function that BlogCFC uses to accommodate this, and then thought I would share it with the world just in case someone asks you fix your blog too.
http://arstechnica.com/news.ars/post/20080626-conf...
^['_a-z0-9-]+(.['_a-z0-9-]+)*(+['_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*.([a-z0-9-]+)$
Something like:
IsValid("Email",Replace(EmailAddress),"+",""))
It isn't nearly as impressive to look at as the regex example, but I am not sure that it is any less effective! :)
That would probably work for the most part, but what if someone puts a + in a part of the email address where it doesn't belong, that will pass your validation too like:
[email protected]
or
comment.spammer@fake+domain.com
The RegEx gives you a little more sophistication, and you get to feel smart because you can understand all that goblie-gook.