Re: forward look ahead assertion

"Daniel F. Savarese" <[email protected]> Thu, 06 Nov 2003 02:42:39 -0500
Newsgroups gmane.comp.jakarta.regexp.user
Message-ID <[email protected]>
In message <28B8E04BCFBEB74B9B19F765DE6598E94C867A@ENETSLMAILI.enetsl.Virtusa.c
om>, "Lilantha Darshana" writes:
>Could you tell me whether the regexp supports forward look ahead =
>assertion or not? If not how could we
...
>I.e. xyz should not follow any other characters.

I assume you mean that "xyz should not be followed by any other
characters"

>In Perl we could achieve this kind of matching using pattern like: =
>(?:abc.xyz)(?!\w)

That's actually a zero-width negative lookahead assertion.  I don't
believe regexp supports lookahead or lookbehind assertions.  You'd
need to use jakarta-oro for that.  However, I don't understand why
^abc.xyz$ doesn't do the job for you in this case since you're asking
for an exact match.  Unless you really mean for it to be okay for
non-word characters to follow the string.

daniel