On Tue, Oct 01, 2002 at 12:47:24PM -0700, [EMAIL PROTECTED] wrote:
> On Tue, Oct 01, 2002 at 01:24:45PM -0600, Luke Palmer wrote:
> >
> > > [Negative matching]
> >
> > > a generic negative, multi-byte string matching mechanism. Any thoughts?
> > > Am I missing something already present or otherwise obvious?
> >
> > Maybe I'm misundertanding the question, but I think you want negative
> > lookahead:
> >
> > Perl 5: /(.*)(?!>union)/
> > Perl 6: /(.*) <!before: union>/
> >
> > Luke
>
> no, that doesn't work, because of the way regexes operate. The '.*' captures
> everything, and since the string after everything (ie: the end of the string)
> doesn't match 'union', the regex succeeds without backtracking. Try it:
I think what you want is just a negated assertion:
/<!'union'>+/
Although I don't know what that means exactly. Does it match 5
characters at a time that aren't "union" or does it match one
character at a time as long as the string "union" isn't matched at
that point?
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]