Hello Roger, > I'm looking for a regular expression that matches the first, and only > the first, sequence of the letter 'a', and only if the length of the > sequence is exactly 3.
import sys, re, os if __name__=='__main__': m = re.search('a{3}', 'xyz123aaabbaaabbbbababbbbaabb') print m.group(0) print "Preceded by: \"" + m.string[0:m.start(0)] + "\"" Best wishes, Christoph -- http://mail.python.org/mailman/listinfo/python-list