Email address validation: please stop
blog.sinjakli.co.uk
Email address validation: please stop
1–10 of 86 posts
Re: Email address validation: please stop
#2Re: Email address validation: please stop
#3Re: Email address validation: please stop
#4Re: Email address validation: please stop
#5I do often fall into the trap of trusting the framework's built-in email validation to be correct.
Apparently, this is the regex to match RFC2822 (?:[a-z0-9!#$%&'+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'+/=?^_`{|}~-]+)|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])")@(?:(?:[a-z0-9](?:[a-z0-9-][a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-][a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
Re: Email address validation: please stop
#6I recently changed our email validation: all I do now is check for the existence of an "@".
Re: Email address validation: please stop
#7Re: Email address validation: please stop
#8On the other hand, maybe the specification for email addresses is too loose.
Re: Email address validation: please stop
#9On the other hand, maybe the specification for email addresses is too loose.
Maybe. I all know is that no one should have to write a regexp like this one http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
Usually, in forms, you would ask for the real name and for the email address in separate fields and you wouldn't allow lists to be passed in.
I do agree though: The email address format is (even without the real name part) too complicated to really validate. In my applications, I check if there's an @-sign (I usually need a proper SMTP email address to deliver anyways), but leave the rest to the mail server on send-time, handling the bounces.