Re: How to find all possibly overlapping matches?

2009-08-12 Thread kj
In MRAB writes: >kj wrote: >> >> re.findall finds all non-overlapping matches, but what if one wants >> all (maximal) matches, even those that overlap? >> >> All the solutions I can come up involve calling re.search iteratively, >> each time giving it

Re: How to find all possibly overlapping matches?

2009-08-12 Thread MRAB
kj wrote: re.findall finds all non-overlapping matches, but what if one wants all (maximal) matches, even those that overlap? All the solutions I can come up involve calling re.search iteratively, each time giving it a pos parameter starting just after the start of the previous match. Is

How to find all possibly overlapping matches?

2009-08-12 Thread kj
re.findall finds all non-overlapping matches, but what if one wants all (maximal) matches, even those that overlap? All the solutions I can come up involve calling re.search iteratively, each time giving it a pos parameter starting just after the start of the previous match. Is there a built

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 ar

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:

Overlapping matches

2007-04-01 Thread Rehceb Rotkiv
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? Regards, Rehceb Rotkiv -- http://mail.python.org/mailman/listinfo/python-list

Re: Overlapping matches in Regular Expressions

2005-04-12 Thread Fredrik Lundh
x27;: None, 'id1': 'avi'} > > Which was expected since overlapping matches are ignored. > But I would also like to know if other groups had a match. that's not how regular expressions work: a regular expression describes a set of strings (the regular set), and the engine

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