[Tutor] Regex comments

Michael Powe michael at trollope.org
Thu Sep 16 12:32:37 CEST 2010


The re module includes the option to comment a regular expression with
the syntax (?#comment).  e.g.

p=r'(.*) (?P<grp>WT.dl)(?#parameter)=(?P<val>[^&]+)(?#value).*'

Is there a mechanism for extracting these values from the match, in
the way that group names are extracted?

I don't see one.

The point would be that in my processing of the match, I could
implement the comments as identifiers for the matched value.



Michael Powe		michael at trollope.org		Naugatuck CT USA
"The most likely way for the world to be destroyed, most experts
agree, is by accident.  That's where we come in. We're computer
professionals. We cause accidents."  -- Nathaniel Borenstein, inventor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20100916/d53fd614/attachment.pgp>

More information about the Tutor mailing list