"Christoph Conrad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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)] + "\""
The correct pattern should reject the string: 'xyz123aabbaaab' since the length of the first sequence of the letter 'a' is 2. Yours accepts it, right? -- Roger L. Cauvin [EMAIL PROTECTED] (omit the "nospam_" part) Cauvin, Inc. Product Management / Market Research http://www.cauvin-inc.com -- http://mail.python.org/mailman/listinfo/python-list