Legal email characters regexp

I use GMail for most of my mail. They have a cool feature with which you can add a string to your username part of the email address by ading a +-sign, like this: myusername+astring@gmail.com. Email sent to this address will go to myusername@gmail.com.

This is perfect when you register your email at many sites since you can sort the incoming mail based on the email address given.

The problem is, many email forms have validators that don’t allow +-signs in the email address. I just tried registering at developer.sonyericsson.com but they wouldn’t accept my email.

There’s really no reason for this. There are regular expressions available that do a correct validation. Here’s one example.

Standard

Leave a Reply

Your email address will not be published. Required fields are marked *