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 |