"Alex Martelli" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Tim Chase <[EMAIL PROTECTED]> 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.
...
...
> If a little more than just REs and matching was allowed, it would be
> reasonably easy, but I don't know how to fashion a RE r such that
> r.match(s) will succeed if and only if s meets those very precise and
> complicated specs.  That doesn't mean it just can't be done, just that I
> can't do it so far.  Perhaps the OP can tell us what constrains him to
> use r.match ONLY, rather than a little bit of logic around it, so we can
> see if we're trying to work in an artificially overconstrained domain?

Alex, you seem to grasp exactly what the requirements are in this case.  I 
of course don't *have* to use regular expressions only, but I'm working with 
an infrastructure that uses regexps in configuration files so that the code 
doesn't have to change to add or change patterns.  Before throwing up my 
hands and re-architecting, I wanted to see if regexps would handle the job 
(they have in every case but one).

-- 
Roger L. Cauvin
[EMAIL PROTECTED] (omit the "nospam_" part)
Cauvin, Inc.
Product Management / Market Research
http://www.cauvin-inc.com


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to