On Tue, 2004-09-14 at 10:11, Abhijit Mahabal wrote:
> On Tue, 14 Sep 2004, Austin Hastings wrote:

> > That is, can I say:
> >
> >   $my_rex = qr/fo*/ but not 'foo';

> The word "junction" came to my mind as I read your mail.
> 
> $my_rex = qr/fo*/ & qr:not/foo/;

Of course, the regex itself can do this:

        qr{(fo*) ({$1 ne 'foo'})}

This is probably the superior option, as it can backtrack, where the
others cannot. Thus for the string "foo" you would match "fo" because
you find "foo" first, and it fails, causing the first subexpression to
backtrack, but you can still match "fooo" correctly on the first try.

-- 
â 781-324-3772
â [EMAIL PROTECTED]
â http://www.ajs.com/~ajs

Reply via email to