470,849 Members | 859 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

overlapping regex

km
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

Jul 18 '05 #1
1 1692
In article <ma*************************************@python.or g>, 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
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by André Søreng | last post: by
11 posts views Thread by Max M | last post: by
3 posts views Thread by Phil Sandler | last post: by
4 posts views Thread by Simon Elliott | last post: by
reply views Thread by Bruce | last post: by
1 post views Thread by Jim_Kanepele | last post: by
4 posts views Thread by Charlie Brown | last post: by
4 posts views Thread by =?ISO-8859-15?Q?Jean=2DFran=E7ois?= Lemaire | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.