Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > overlapping regex

Reply
Thread Tools

overlapping regex

 
 
Kenneth McDonald
Guest
Posts: n/a
 
      06-16-2004
In article <(E-Mail Removed)>, km wrote:
> Hi all,
>
> python re module deals with only nonoverlapping matches. how to go for if i want to find out overlapping matches and their span ?
> regards,
> KM
>


The easiest way would be to, after you've found a match (using something
like the search method of comipiled re's), repeat the search starting
one character further along that the start of the previously found
match. This strategy may require some adjustment depending on the
exact patterns you're using, since you may find you don't want
_all_ overlapping patterns, but it should work and I can't think of
a better way of doing it.

Cheers,
Ken
 
Reply With Quote
 
 
 
 
km
Guest
Posts: n/a
 
      06-16-2004
Hi all,

python re module deals with only nonoverlapping matches. how to go for if i want to find out overlapping matches and their span ?
regards,
KM

 
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
How make regex that means "contains regex#1 but NOT regex#2" ?? seberino@spawar.navy.mil Python 3 07-01-2008 03:06 PM
Overlapping regex help Bil Kleb Ruby 2 08-20-2005 01:33 PM
PIX: IPSec between overlapping subnets and "dns" keyword Oleg Tipisov Cisco 0 08-10-2004 08:29 AM
regexp to list all sentences and sub sentences, with overlapping? Tony Perl 4 11-27-2003 01:38 PM
Pix 506e, VPN, and overlapping pools... a love story Nate Smith Cisco 2 10-21-2003 03:38 PM



Advertisments