Lurker News

Comments (129) 40 threads

Show all comments

Showing thread 8 of 40

rubyn00bie1 reply#
Nice work on this!

Something subtle, but I quite loved the email regex is, IMHO, close to perfect: \S+@\S+\.\S+
Because the "perfect" one is just absurd, and no one realizes it's going to be so fucking absurd until they start getting support cases and then go read something like this: https://stackoverflow.com/a/201378/931209
> If you want to get fancy and pedantic, implement a complete state engine. A regular expression can only act as a rudimentary filter. The problem with regular expressions is that telling someone that their perfectly valid e-mail address is invalid (a false positive) because your regular expression can't handle it is just rude and impolite from the user's perspective.

p4lindromica#
Even this regexp has false positives.

The `ai` ccTLD ran their own mail server at the root, so an address like `a@ai` was a valid email address.
They serve a website at the tld root: http://ai./