in reply to regexp find last word
If the next thing you see is fox, and it is not followed by some string containing fox followed later by forest, and it is followed by forest, then stick in "the ".s/(?=fox(?!.*fox.*forest).*forest)/the /;
Alternatively:
If the next thing you see is fox, and it is followed by a sequence of characters, none of which starts another fox, and then you see forest, stick in "the ".s/(?=fox(?:(?!fox).)*forest)/the /;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regexp find last word
by ikegami (Patriarch) on Mar 02, 2005 at 15:43 UTC |