Match First Sequence in Regular Expression?

Roger L. Cauvin roger at
Thu Jan 26 12:21:03 EST 2006

"Christos Georgiou" <tzot at> wrote in message 
news:9m0it1l6vdl26jbsrsjqm9og7su7tir314 at
> On Thu, 26 Jan 2006 17:09:18 GMT, rumours say that "Roger L. Cauvin"
> <roger at> might have written:
>>Thanks, but the second test case I listed contained a typo.  It should 
>>contained a sequence of three of the letter 'a'.  The test cases should 
>>"xyz123aaabbab" accept
>>"xyz123aabbaaab" reject
> Here I object to either you or your need for a regular expression.  You 
> see,
> before the "aaa" in your second test case, you have an "arbitrary sequence
> of characters", so your requirements are met.

Well, thank you for your efforts so far, Christos.

My purpose is to determine whether it's possible to do this using regular 
expressions, since my application is already architected around 
configuration files that use regular expressions.  It may not be the best 
architecture, but I still don't know the answer to my question.  Is it 
*possible* to fulfill my requirements with regular expressions, even if it's 
not the best way to do it?

The requirements are not met by your regular expression, since by definition 
the "arbitrary sequence of characters" stops once the sequences of a's and 
b's starts.

Roger L. Cauvin
nospam_roger at (omit the "nospam_" part)
Cauvin, Inc.
Product Management / Market Research

More information about the Python-list mailing list