On Jan 7, 2014, at 12:55 PM, Gene Wirchenko <ge...@telus.net> wrote:

> Regexes sure get talked up, but they can easily turn into write-only code. 

True, which is why I like the 'verbose' flag in the Python regular expression 
module. This allows you to break up your pattern string into multiple lines, 
with a comment for each part. The expression I submitted would be written like 
this:

import re
pat = re.compile(r"                                                             
   
        ^          # Start of string                                            
   
        [^@]+      # More than one of any character but '@'                     
   
        @          # The '@' character                                          
   
        [^\.\@]+   # More than one of any character except '@' or '.'           
   
        \.         # The '.' character                                          
   
        [^@]+",    # More than one of any character but '@'                     
   
        re.VERBOSE)

-- Ed Leafe


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/2a91fa1e-0878-41c5-bc34-705104602...@rackspace.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to