[Zope-CMF] Re: [dev] _checkEmail issues

Paul Winkler pw_lists at slinkp.com
Fri Oct 20 17:28:20 EDT 2006


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.


-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope-CMF mailing list