Charles Hartman wrote: > pat = sre.compile('(x[x/])+') > (longest, startlongest) = max([(fnd.end()-fnd.start(), fnd.start()) for > i in range(len(marks)) > for fnd in pat.finditer(marks,i)])
If I'm understanding that correctly, the only way for you to get different best matches are at offsets 0 and 1; offset 2 will yield the same matches as 0, with the possibility of excluding the first two characters -- i. e. any different matches should be guaranteed to be shorter. Therefore ... for i in range(2) ... instead of ... for i in range(len(marks)) ... should be sufficient. Peter -- http://mail.python.org/mailman/listinfo/python-list