Your regex matches at the earliest possible position. That weighs more than the laziness caused by the ?. Therefore you need to force it behind the first "fox".s/(fox.+)(fox.+?forest)/${1}the $2/;
In reply to Re: regexp find last word
by holli
in thread regexp find last word
by Murcia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |