Re: Overlapping matches

2007-04-01 Thread Rehceb Rotkiv
Both methods work well, thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Overlapping matches

2007-04-01 Thread attn . steven . kuo
On Apr 1, 1:38 pm, Rehceb Rotkiv <[EMAIL PROTECTED]> wrote: > In the re documentation, it says that the matching functions return "non- > overlapping" matches only, but I also need overlapping ones. Does anyone > know how this can be done? Perhaps lookahead assertions are what you're looking for?

Re: Overlapping matches

2007-04-01 Thread Ant
On Apr 1, 9:38 pm, Rehceb Rotkiv <[EMAIL PROTECTED]> wrote: > In the re documentation, it says that the matching functions return "non- > overlapping" matches only, but I also need overlapping ones. Does anyone > know how this can be done? Something like the following: import re s = "" p

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