Posts Tagged perl

Validate email addresses

You probably never tried to validate email addresses, I did, and it doesn’t seem to be hard, but it is (sorry if you also did 😉 )!
I was searching for a regexp, and if you search one you will find tone of them, but you don’t know which one to choose. Some are very long, some are too restictive (doesn’t handle new TLDs or handle only TLDs with three letters), some are RFC-822 compliant but they seems complicated, and I wonder if all addresses are RFC 822 compliant (It’s pretty often that RFC are not respected) … Also, it’s not because the format of the email address is valid, that that mail exists. The best and easy solution I came with, which is not the full solution, is to use the Email::Valid perl module like this:

Read the rest of this entry »


Leave a Comment