in reply to regexp find last word
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/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regexp find last word
by Roy Johnson (Monsignor) on Mar 02, 2005 at 15:16 UTC | |
|
Re^2: regexp find last word
by manav (Scribe) on Mar 02, 2005 at 15:39 UTC | |
|
Re^2: regexp find last word
by Anonymous Monk on Mar 02, 2005 at 14:55 UTC |