Match First Sequence in Regular Expression?

Alex Martelli aleax at
Thu Jan 26 09:52:30 EST 2006

Tim Chase <python.list at> wrote:
> I'm not quite sure what your intent here is, as the
> resulting find would obviously be "aaa", of length 3.

But that would also match 'aaaa'; I think he wants negative loobehind
and lookahead assertions around the 'aaa' part.  But then there's the
spec about matching only if the sequence is the first occurrence of
'a's, so maybe he wants '$[^a]*' instead of the lookbehind (and maybe
parentheses around the 'aaa' to somehow 'match' is specially?).

It's definitely not very clear what exactly the intent is, no...


More information about the Python-list mailing list