Hi Seb!

Seb Bacon wrote:
Agreed that it's too restrictive.  FWIW we have been using this in
production.  It was based on careful checking of the various RFCs
(though I've just noticed it should also restrict the domain name to
255 characters):

_email_rgx = re.compile(r'^([A-Za-z0-9!#$%&\'*+-/=?^_`{|}~][A-Za-z0-9!#$%&\'*+-/

I like your regex, but I see two small issues:

1.) The last '-' in '[A-Za-z0-9!#$%&\'*+-/=?^_`{|}~]' has to be escaped. I'll use this instead:


2.) '[A-Za-z0-9!#$%&\'*+-/=?^_`{|}~\.]{0,63}' allows '.' in any place. I'll use the same pattern as for the domain:


The complete regex would look like this:


I can't see a way to combine this pattern with a length check. So I would need a second expression to check the length of the two parts.

Does that make sense?



Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to