re.sub and named groups

Emanuele D'Arrigo manu3d at gmail.com
Wed Feb 4 18:23:45 CET 2009


On Feb 4, 5:17 pm, MRAB <goo... at mrabarnett.plus.com> wrote:
> You could use the lazy form "*?" which tries to match as little as
> possible, eg "\(\?P<first>.*?\)" where the ".*?" matches:
> spam:(?P<first>.*) ham:(?P<second>.*)
> giving "spam:foo ham:(?P<second>.*)".

A-ha! Of course! That makes perfect sense! Thank you! Problem solved!

Ciao!

Manu




More information about the Python-list mailing list