#575 invalid
Jonas

Correct validation for email

Reported by Jonas | September 25th, 2008 @ 11:48 AM

The validation for email fails in many cases. I've been looking for a regular expression more correct.

  • This will match 99.99% of all email addresses in actual use today:

[a-z0-9!#$%&'+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)@(?:a- z0-9?.)+a-z0-9?

  • The next allow any two-letter country code top level domain, and only specific generic top level domains. It is necessary update it as new top-level domains are added:

[a-z0-9!#$%&'+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)@(?:a- z0-9?.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz| info|mobi|name|aero|jobs|museum)\b

Comments and changes to this ticket

  • Sam Smoot

    Sam Smoot September 25th, 2008 @ 02:09 PM

    • State changed from “new” to “invalid”

    That doesn't appear to be a Ruby Regexp (it's not escaped properly), and doesn't cover some of the test cases already present.

    I do want to commit to solving this problem, but I suspect that a Regexp is the wrong way to do it if we want better coverage.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages