tag:blogger.com,1999:blog-11523536.post5240002421347480649..comments2023-10-28T06:20:02.504-04:00Comments on sernaferna: Regular ExpressionsDavid Hunterhttp://www.blogger.com/profile/08992882297558499646noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-11523536.post-32072378271928920782010-03-30T08:58:47.375-04:002010-03-30T08:58:47.375-04:00Yes, all those characters are valid per the RFC --...Yes, all those characters are valid per the RFC -- along with a few others, like { and }.<br /><br />Email address validation is one of those things that SOUNDS easy, but in reality email addresses are defined by a horribly complex grammar that allows any number of non-intuitive and highly surprising constructs (like, say.. comments. No, really).<br /><br />As far as email validation regexes go this is actually pretty good -- I've seen some horrible ones that fail in dumb ways.<br /><br />Things this does miss (ignoring the more subtle corners of the spec) include "me@localhost" and domains in punycode for internationalisation (with a leading "xn--" in the host part)<br /><br />A regex to actually valide per the RFC is enormous -- this is covered in the O'Reilly 'Mastering Regular Expressions' book, and it takes up a page or more. I think this is it here: http://www.ex-parrot.com/pdw/Mail-RFC822-Address.htmlPaulhttps://www.blogger.com/profile/00089945997667148310noreply@blogger.com