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

That fails on the perfectly valid email address: "Foo@bar"@example.com

Although if that's your email address, you deserve everything you get ;)

If you want to verify if an email address is valid, just ask your mail server if it is capable of sending mail to it:

  root@flan:~# /usr/sbin/sendmail -bv '"Foo@bar"@example.com'
  "Foo@bar"@example.com verified
  root@flan:~#


Does it fail? I don't see ^ or $.


The regexp looks for exactly one '@'-character preceded and followed by at least one character that's not an '@'-character. Or, in other words, it does not allow for an email address with more than one '@'-character.


The point of the post was that since the regexp doesn't include start or end of a string it would still succeed:

"Foo@bar"@example.com -> "Foo@bar"


I assumed it was anchored and he missed those off.


I don't need those “perfectly valid” email addresses. Person who create such addresses potentially dangerous.




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

Search: