[Python-Dev] pre-PEP: Complete, Structured Regular Expression Group Matching (original) (raw)
Raymond Hettinger python at rcn.com
Fri Aug 6 16:30:10 CEST 2004
- Previous message: [Python-Dev] pre-PEP: Complete, Structured Regular Expression Group Matching
- Next message: [Python-Dev] Re: pre-PEP: Complete, Structured Regular Expression Group Matching
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
A notable limitation of the
re.match
method is that it fails to capture all group match information for repeatedly matched groups. For example, in a call like this ::m0 = re.match(r'([A-Z]|[a-z])*', 'XxxxYzz') one would like to see that the group which matched four times matched the strings
'X'
,'xxx'
,'Y'
and'zz'
.
I suspect there is a typo in the example and that the asterisk should precede the right paren:
m0 = re.match(r'([A-Z]|[a-z]*)', 'XxxxYzz')
Raymond
- Previous message: [Python-Dev] pre-PEP: Complete, Structured Regular Expression Group Matching
- Next message: [Python-Dev] Re: pre-PEP: Complete, Structured Regular Expression Group Matching
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]