Match First Sequence in Regular Expression?

Alex Martelli aleax at mail.comcast.net
Thu Jan 26 17:06:47 CET 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