|
|
|
|
|
by csense
4743 days ago
|
|
Those regular expressions desperately need refactored. Maybe like this: c = r"[-!#$%&'*+/=?^_`{}|~0-9A-Z]"
dot_atom = r"{c}+(\.{c}+)*".format(c=c)
c1 = r"[\001-\010\013\014\016-\037!#-\[\]-\177]"
c2 = r"[\001-\011\013\014\016-\177]"
quoted_string = r"'({c1}|\\{c2})*'".format(c1=c1, c2=c2)
c = r"[A-Z0-9]"
dash_something = r"(?:-*{c}+)".format(c=c)
domain = r"(?:{c}+{dash_something}\.)+{c}{{2,6}}".format(c=c, dash_something=dash_something)
email = "^({dot_atom}|{quoted_string})@{domain}$"
There's a typo in the original, which I fixed: \001-011 should be \001-\011. |
|