Lately, I have been trying to define a common basis for most of my web projects, since I often end up reinventing the wheel every time. I have tried a few PHP frameworks, but none of them tickled my fancy, but I have complicated tastes. I am known for reimplementing something from scratch rather than…
Tag: regexp
Overkill e-mail validation
I just came across an insane code snippet to validate e-mail addresses, apparently derived from RFC 822. It is in the form of a Perl module that can be downloaded at http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html. The Perl code is intertwined with just a little bit of regexp hell, and looks as follows: (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\”.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t] )+|\Z|(?=[\[“()<>@,;:\\”.\[\]]))|”(?:[^\”\r\\]|\\.|(?:(?:\r\n)?[ \t]))*”(?:(?: \r\n)?[…