24 | | email_re = re.compile( |
25 | | r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom |
26 | | r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' # quoted-string |
27 | | r')@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}$', re.IGNORECASE) # domain |
| 24 | |
| 25 | DOT_ATOM = r"[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(?:\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" |
| 26 | QUOTED_STRING = r'"(?:[\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"' |
| 27 | DOMAIN = r'(?:[A-Z0-9-]+\.)+[A-Z]{2,6}' |
| 28 | ADDR_SPEC = "((?:" + DOT_ATOM + ")|(?:" + QUOTED_STRING + "))@(" + DOMAIN + ")" |
| 29 | DISPLAY_NAME = r'(?:\w[\w ]*)' |
| 30 | |
| 31 | email_re = re.compile("^(?:" + ADDR_SPEC + ")|" + DISPLAY_NAME + "<" + ADDR_SPEC + ">$", re.IGNORECASE) |
| 32 | |