From: egrasso Date: 2008-07-14T23:05:41+09:00 Subject: regexp with gaps Hi, I need to find the position of some substrings inside of a long string. For this I'm using a loop that uses str.index(pattern, (last_found_position+1)) so I find all positions where the pattern matches. The pattern is a string of 20 chars, different each time I run the script. That worked perfect. The problem is that now I need to find all positions where the pattern matches 12 or more chars. For example: For the pattern "aaaaaa", find substrings "aaaaaa", "aaabaa", "baaaaa", "ababaa", etc First I thought that I could create all possible patterns (with \w) and check them, but I realized that there would be a lot of different patterns to check (over a few hundreds I think). Is there any way to do this without the need of checking a lot of patterns? thanks