Match First Sequence in Regular Expression?
Roger L. Cauvin
roger at deadspam.com
Thu Jan 26 10:13:34 EST 2006
"Sybren Stuvel" <sybrenUSE at YOURthirdtower.com.imagination> wrote in message
news:slrndthmgj.kck.sybrenUSE at schuimige.unrealtower.org...
> 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?
The first option describes what I want, with the additional restriction that
the "first sequence of the letter 'a'" is defined as 1 or more consecutive
occurrences of the letter 'a', followed directly by the letter 'b'.
--
Roger L. Cauvin
nospam_roger at cauvin.org (omit the "nospam_" part)
Cauvin, Inc.
Product Management / Market Research
http://www.cauvin-inc.com
More information about the Python-list
mailing list