Hacker News new | past | comments | ask | show | jobs | submit login

You can only validate a zip code, a phone number, an address, or an email address using a regex up to a point.

There are too many dispartities from a country to the next for the first three to hope validating anything withhout a bunch of false negatives. Some countries don't have zip codes.

For emails, blindly following the RFCs yields a monster (see [1]), and it won't help you if you run into oddball email addresses that are not RFC-compliant but work regardless due to technical implementations (or vice versa).

http://regular-expressions.mobi/email.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: