Comment 6 for bug 1199386

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : Re: Email address regular expression needs work

Here are various occurences of regular expressions looking very strongly like email matching regexps I found with grep in the trunk branches:

ack --type=python 're\.(compile|search|match).*@' server/trunk addons/trunk web/trunk/
server/trunk/openerp/addons/base/ir/ir_mail_server.py
123:name_with_email_pattern = re.compile(r'("[^<@>]+")\s*<([^ ,<@]+@[^> ,]+)>')
124:address_pattern = re.compile(r'([^ ,<@]+@[^> ,]+)')

server/trunk/openerp/tools/mail.py
58: part = re.compile(r"(<(([^a<>]|a[^<>\s])[^<>]*)@[^<>]+>)", re.IGNORECASE | re.DOTALL)
487:email_re = re.compile(r"""([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})""", re.VERBOSE)
490:single_email_re = re.compile(r"""^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$""", re.VERBOSE)
498:reference_re = re.compile("<.*-open(?:object|erp)-(\\d+)(?:-([\w.]+))?.*@(.*)>", re.UNICODE)

addons/trunk/survey/wizard/survey_answer.py
704: if re.match("^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", val1) == None:
743: if re.match("^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", val1) == None:
906: if re.match("^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", val) == None:
942: if re.match("^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", val) == None:

addons/trunk/crm/base_partner_merge.py
741: re_email = re.compile(r".*@")

This badly needs unification and consistency.