in reply to Re: regexp find last word
in thread regexp find last word

What happens in case of
fox comes and the fox goes into forest
The code given above will put a the in front of every last fox irrespective of if a the was already there or not.

while(<DATA>) { s/(?<!the )fox(?!.*fox)/the fox/ ; print; } __DATA__ the fox comes and fox goes into forest fox comes and fox goes into forest the fox comes and the fox goes into forest fox comes and the fox goes into forest


Manav