re.sub and named groups

Emanuele D'Arrigo manu3d at
Wed Feb 4 12:23:45 EST 2009

On Feb 4, 5:17 pm, MRAB <goo... at> 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!



More information about the Python-list mailing list