Match First Sequence in Regular Expression?

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Thu Jan 26 15:17:55 CET 2006


Roger L. Cauvin enlightened us with:
> I'm looking for a regular expression that matches the first, and
> only the first, sequence of the letter 'a', and only if the length
> of the sequence is exactly 3.

Your request is ambiguous:

1) You're looking for the first, and only the first, sequence of the
   letter 'a'. If the length of this first, and only the first,
   sequence of the letter 'a' is not 3, no match is made at all.

2) You're looking for the first, and only the first, sequence of
   length 3 of the letter 'a'.

What is it?

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list