On 16 Aug 2006 15:23:06 -0700, fuzzylollipop <[EMAIL PROTECTED]> wrote: > I want to do email address format validations, without turning to ANTLR > or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. > Most of the ones I have found from google searches are not really as > robust as I need them to be. >
RFC 2821 and 2822 specify the format for email addresses. Contrary to popular belief, just about all characters are valid and this makes validating an address format very difficult. Also, just because an email address is in the correct format doesn't mean its a real or valid address. http://en.wikipedia.org/wiki/E-mail_address has a short overview >From experience, you might be better off not putting too much energy into this, and maybe instead just do a basic template validation eg: some text followed by @ followed by some text which when split by '.' gives at least 2 parts. In addition a DNS MX record lookup will tell you if the domain part is capable of receiving email, the address can't be valid (for internet transmission) without MX records. If you want to take it a step further, you can also query the server(s) pointed to in the MX records, but this takes time, and is not accurate. Some domains have catchalls, and others like yahoo don't refuse an address until after a whole email has been received. HTH :) -- http://mail.python.org/mailman/listinfo/python-list