in reply to Re: Replacing exactly the found instance in REGEX
in thread Replacing exactly the found instance in REGEX

You have made a slight mistake with your look-ahead syntax.

(?=pattern) Positive look-ahead match is followed by pattern
(?!pattern) Negative look-ahead match is not followed by pattern
(?<=pattern) Positive look-behind match is preceeded by pattern
(?<!pattern) Negative look-behind match is not preceeded by pattern

Note that for look-behind assertions the pattern can not be of variable width.

I hope this is of interest.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^3: Replacing exactly the found instance in REGEX
by inquis (Initiate) on Dec 09, 2008 at 13:08 UTC
    Thanks a lot for your inputs. For now, I am able to continue by using the syntax in the first reply. I will also try and understand the lookahead and lookbehind assertions and their usage.
    Regards,
    inquis