Regexp Quiz
Quick, what’s this:
^[-!#$%∓'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%∓'*+/0-9=?A-Z^_a-z{|}~])*@[a-zA-Z](-?[a-zA-Z0-9])*(\.[a-zA-Z](-?[a-zA-Z0-9])*)+$
Reply in the comments if you know what this regexp matches. Bonus point if you catch an omission.
It looks, at first glance, like a simple minded email address matcher. A fully compliant RFC822 format matcher runs to something like a page in length.
Even if it isn’t, I have the feeling you should be backwhacking your ‘.’s, and I doubt you really want & in your character ranges.
At first I thought email address too but the portion before the @ seems too permissive and the portion after the @ too restrictive. The portion after the @ might follow RFC1035, but it would exclude things like 37signals.com as domain names.
It is, in fact a simple-minded email regexp — I just found it funny that even at this length, it’s only a tiny portion of the real one:
http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html