On Jan 7, 2014, at 12:55 PM, Gene Wirchenko <[email protected]> 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: [email protected]
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/[email protected]
** 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.