$_ = "fox comes and fox goes into forest" s/(fox.+?forest)/the $1/; print;
prints: the fox comes and fox goes into forest
but what I want is: fox comes and the fox goes into forest
put the word "the" before the nearest (or last fox) relative to forest
I know this should be simple, but I have a block somewhere, I can not find the solution .... Best regards Murcia
In reply to regexp find last word by Murcia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |