This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author verdy_p
Recipients ezio.melotti, r.david.murray, verdy_p
Date 2009-10-14.23:44:01
SpamBayes Score 2.1763673e-05
Marked as misclassified No
Message-id <1255563842.89.0.44976557928.issue7132@psf.upfronthosting.co.za>
In-reply-to
Content
ezio said:
>>> re.match('^(\d{1,3})(?:\.(\d{1,3})){3}$', '192.168.0.1').groups()
('192', '1')
> If I understood correctly what you are proposing, you would like it to
return (['192'], ['168', '0', '1']) instead.

Yes, exactly ! That's the correct answer that should be returned, when 
the R flag is set.

> This will also require an additional step to join the two lists to get 
the list with the 4 values.

Yes, but this is necessary for full consistency of the group indexes. 
The current return value is clearly inconsistant (generally it returns 
the last occurence of the capturing group, but I've discovered that this 
is not always the case, because of matches that are returned after 
backtracking...)

It is then assumed that when the R flag is set, ALL occurences of 
repeated groups will be returned individually, instead of just a 
'random' one. Note that for full generalization of the concept, there 
should even be lists of lists if a capturing group contains itself 
another inner capturing group (with its own index), in order to 
associate them correctly with each occurence of the outer capturing 
group (however I've still not experimented this in my local 
experimentation, so all occurences are grouped in the same returned 
list, independantly of the occurence of the outer capturing group in 
which they were found).
History
Date User Action Args
2009-10-14 23:44:02verdy_psetrecipients: + verdy_p, ezio.melotti, r.david.murray
2009-10-14 23:44:02verdy_psetmessageid: <1255563842.89.0.44976557928.issue7132@psf.upfronthosting.co.za>
2009-10-14 23:44:01verdy_plinkissue7132 messages
2009-10-14 23:44:01verdy_pcreate