E-Mail Address Validation -- "Yahoo! You're all clear k
Posted: Fri Apr 26, 2002 4:24 am
For quite some time I have wanted to come up with a good regular expression for validating e-mail addresses. When I say for quite some time I mean since years ago--back when I wrote a lot of Perl, which I hardly do lately since I have been so into using PHP, SQL, and even a bit of C for doing dynamic web stuff. I vaguely recall coming up with a simple, mostly sufficient but rather loose pattern or two at some point for some project or another, but I never really got serious about making a more complex pattern for stricter matching until recently. After some research and some tinkering, I have come up with a regular expression that seems better than any other I have come across for e-mail address validation, including some I found on the Zend site. I do not want to sound cocky, but I am very pleased with my work! With this, I can validate e-mail addresses in many, many projects better than I have ever done before. I feel a bit like Luke Skywalker when Han Solo swoops in like the calvalry, takes out Darth Vader, and announces "Yahoo! You're all clear kid! Now let's blow this thing and go home!" except that I took out Darth Vader myself and I get to take out the Death Star too. Woo hoo! 
I am tempted to paste my shiny new regular expression in right here for all to use, enjoy, and possibly improve upon, but I have made extensive notes about what everything actually does (so I will not forget then have to work it out later; documentation is your friend) and I am planning to work everything into a nice article. That way, I can explain what everything does and how to use it instead of just dropping down some code out of context. I am fairly busy looking for work and attending school right now, but I may be able to make the time to write the article this weekend.
If you would be interested in reading yet another article about e-mail address validation, please feel free to post a note here--including anything you would like to see that you think other articles have left out or not explained well enough.
I am tempted to paste my shiny new regular expression in right here for all to use, enjoy, and possibly improve upon, but I have made extensive notes about what everything actually does (so I will not forget then have to work it out later; documentation is your friend) and I am planning to work everything into a nice article. That way, I can explain what everything does and how to use it instead of just dropping down some code out of context. I am fairly busy looking for work and attending school right now, but I may be able to make the time to write the article this weekend.
If you would be interested in reading yet another article about e-mail address validation, please feel free to post a note here--including anything you would like to see that you think other articles have left out or not explained well enough.