Michael Powe wrote: > 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.
You could write a regular expression to extract them ;) > The point would be that in my processing of the match, I could > implement the comments as identifiers for the matched value. But that's what the names are for, e. g.: >>> re.compile(r'(.*) (?P<parameter>WT.dl)=(?P<value>[^&]+).*').search( " WTxdl=yadda&ignored").groupdict() {'parameter': 'WTxdl', 'value': 'yadda'} Or am I missing something? Peter _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor