Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"user@127.0.0.1" isn't even valid. An IP address as a host requires square brackets a la user@[127.0.0.1] - but this is only by RFC, and no real site allows signing up with an IP address instead of a hostname.

Email validation is simple. You take the full RFC regex, and remove the notations permitting square brackets and comments. You wind up with a regex that accepts exactly 100% of real-world email addresses. If your regex contains "\.(com|org|...)", you're doing it wrong.

If you can't figure out how to do the full regex properly, then match against /^[^@]+@[^.]+\./ - or hell, just check for an '@' symbol - as a basic "hrm that kinda looks like an email address" and send the email. It's really not difficult. The only problem is naive English-speaking people who only deal with latin1 thinking that [a-z0-9]+ is somehow the only valid criteria for a username or hostname.



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

Search: