Author verdy_p
Recipients ezio.melotti, verdy_p
Date 2009-10-15.00:45:28
SpamBayes Score 1.69204e-06
Marked as misclassified No
Message-id <>
>>> re.match('^(\d{1,3})(?:\.(\d{1,3})){3}$', '').groups()
('192', '1')
> If I understood correctly what you are proposing, you would like it to
return (['192'], ['168', '0', '1']) instead.

In fact it can be assembled in a single array directly in the regexp, by 
naming the destination capturing group (with the same name, it would get 
the same group index, instead of of allocating a new one). E.g., with 
someting like:

>>> re.match('^(?P<parts>=\d{1,3})(?:\.(?P<parts>=\d{1,3})){3}$', 

would return ("parts": ['192', '168', '0', '1']) in the same first 

This could be used as well in PHP (which supports associative arrays for 
named groups which are also indexed positionnaly).
Date User Action Args
2009-10-15 00:45:30verdy_psetrecipients: + verdy_p, ezio.melotti
2009-10-15 00:45:30verdy_psetmessageid: <>
2009-10-15 00:45:29verdy_plinkissue7132 messages
2009-10-15 00:45:28verdy_pcreate