overlapping regex

Discussion in 'Python' started by Kenneth McDonald, Jun 16, 2004.

  1. In article <>, 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
    Kenneth McDonald, Jun 16, 2004
    #1
    1. Advertising

  2. Kenneth McDonald

    km Guest

    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
    km, Jun 16, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony
    Replies:
    4
    Views:
    2,124
    Andy De Petter
    Nov 27, 2003
  2. Harry Whitehouse
    Replies:
    3
    Views:
    429
    Harry Whitehouse
    Jul 22, 2003
  3. mark

    overlapping datagrids

    mark, Mar 3, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    355
    Chris Jackson
    Mar 5, 2004
  4. Replies:
    3
    Views:
    726
    Reedick, Andrew
    Jul 1, 2008
  5. Bil Kleb

    Overlapping regex help

    Bil Kleb, Aug 19, 2005, in forum: Ruby
    Replies:
    2
    Views:
    92
    Bil Kleb
    Aug 20, 2005
Loading...

Share This Page