Hi!

Paul Winkler wrote:
On Fri, Oct 20, 2006 at 10:03:03PM +0100, Martin Aspeli wrote:
The complete regex would look like this:

re.compile(r'^([\w!#$%&\'*+\-/=?^`{|}~]+(\.[\w!#$%&\'*+\-/=?^`{|}~]+)*'
          r'|"[^(\|")]*")@[\w-]+(\.[\w-]+)+$')

That is possibly the ugliest sequence of characters I have ever seen.

Heh. There are lots of regexes floating around that attempt to solve
email.  For example
http://regexlib.com/DisplayPatterns.aspx?cattabindex=0&categoryId=1

If I were doing it from scratch I'd break it into manageable
chunks and use simpler regexes on the fragments.
Split on '@' for a start.  Trying to do something as non-regular
as email addresses with one regular expression just hurts my head
too much.

I did not plan to reinvent the wheel. But too many inadequate regexes are floating around. So writing a new one seemed to be easier than finding a good existing one.

I hope the two regexes I checked in will do the job:
http://svn.zope.org/CMF/trunk/CMFDefault/utils.py?view=diff&r1=70883&r2=70882


Cheers,

        Yuppie

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

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

Reply via email to