Match First Sequence in Regular Expression?

Alex Martelli aleax at mail.comcast.net
Thu Jan 26 11:06:47 EST 2006


Christoph Conrad <nospam at spamgourmet.com> wrote:

> Hello Roger,
> 
> > since the length of the first sequence of the letter 'a' is 2. Yours
> > accepts it, right?
> 
> Yes, i misunderstood your requirements. So it must be modified
> essentially to that what Tim Chase wrote:
> 
>     m = re.search('^[^a]*a{3}b', 'xyz123aabbaaab')

...but that rejects 'aazaaab' which should apparently be accepted.


Alex



More information about the Python-list mailing list