Match First Sequence in Regular Expression?
Alex Martelli
aleax at mail.comcast.net
Thu Jan 26 22:10:25 EST 2006
Christoph Conrad <nospam at spamgourmet.com> wrote:
> Hallo Alex,
>
> >> r = re.compile("[^a]*a{3}b+(a+b*)*") matches = [s for s in
> >> listOfStringsToTest if r.match(s)]
>
> > Unfortunately, the OP's spec is even more complex than this, if we are
> > to take to the letter what you just quoted; e.g. aazaaab SHOULD match,
>
> Then it's again "a{3}b", isn't it?
Except that this one would also match aazaaaaab, which it shouldn't.
Alex
More information about the Python-list
mailing list