"Dirk Hagemann" <DirkHagemann at gmail.com> writes: > I think I can tell you WHY this happens, but I don't know a work-around > at the moment. len(re.findall('_(?=a_)', '_a_a_a_a_')) # untested def countWithOverlaps(s, pat): return len(re.findall("%s(?=%s)" % (re.escape(pat[0]), re.escape(pat[1:])),s)) 'as