Match First Sequence in Regular Expression?
Roger L. Cauvin
roger at deadspam.com
Thu Jan 26 11:41:08 EST 2006
"Peter Hansen" <peter at engcorp.com> wrote in message
news:mailman.1086.1138293339.27775.python-list at python.org...
> Roger L. Cauvin wrote:
>> Sorry for the confusion. The correct pattern should reject all strings
>> except those in which the first sequence of the letter 'a' that is
>> followed by the letter 'b' has a length of exactly three.
>>
>> Hope that's clearer . . . .
>
> Examples are a *really* good way to clarify ambiguous or complex
> requirements. In fact, when made executable they're called "test cases"
> :-), and supplying a few of those (showing input values and expected
> output values) would help, not only to clarify your goals for the humans,
> but also to let the proposed solutions easily be tested.
Good suggestion. Here are some "test cases":
"xyz123aaabbab" accept
"xyz123aabbaab" reject
"xayz123aaabab" accept
"xaaayz123abab" reject
"xaaayz123aaabab" accept
--
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