Re: Overlapping matches in Regular Expressions

2005-04-12 Thread Fredrik Lundh
André Søreng wrote: > With the re/sre module included with Python 2.4: > > pattern = "(?Pavi)|(?Pavi|mp3)" > string2match = "some string with avi in it" > matches = re.finditer(pattern, string2match) > ... > matches[0].groupdict() > {'id2': None, 'id1': 'avi'} > > Which was expected since overlapp

Overlapping matches in Regular Expressions

2005-04-12 Thread André Søreng
With the re/sre module included with Python 2.4: pattern = "(?Pavi)|(?Pavi|mp3)" string2match = "some string with avi in it" matches = re.finditer(pattern, string2match) ... matches[0].groupdict() {'id2': None, 'id1': 'avi'} Which was expected since overlapping matches are ignored. But I would also