Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to find all possibly overlapping matches?

Reply
Thread Tools

How to find all possibly overlapping matches?

 
 
kj
Guest
Posts: n/a
 
      08-12-2009


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-in solution to such a task?

TIA!

kynn
 
Reply With Quote
 
 
 
 
MRAB
Guest
Posts: n/a
 
      08-12-2009
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 there a built-in solution to such a task?
>

Not in the re module.

It has been requested and is in my regex implementation at
http://bugs.python.org/issue2636 if you want to try that.
 
Reply With Quote
 
 
 
 
kj
Guest
Posts: n/a
 
      08-12-2009
In <mailman.7.1250097801.2903.python-> 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 a pos parameter starting just after the start
>> of the previous match.
>>
>> Is there a built-in solution to such a task?
>>

>Not in the re module.


>It has been requested and is in my regex implementation at
>http://bugs.python.org/issue2636 if you want to try that.


Cool. Thanks!

kynn
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How find all overlapping pattern? Peng Yu Perl Misc 8 02-08-2011 07:07 PM
vpn on 2811 with overlapping networks and all natting on one side Robby Cauwerts Cisco 2 11-27-2007 06:25 AM
[Possibly a FAQ - but one I can't find documented] netspam@shic.co.uk XML 4 05-27-2005 10:04 PM
regexp to list all sentences and sub sentences, with overlapping? Tony Perl 4 11-27-2003 01:38 PM



Advertisments