in reply to Re^2: match last element instead of first??
in thread match last element instead of first??
No:
perl -le "$_=shift; m/fish(.*?)$/ and print $1" "one fish two fish thr +ee fish"
gives
two fish three fish
.*? will match as little as necessary, but it will not match as little as possible. The fish will still match at the leftmost position. Then, the .*? will match as little as necessary to make the match succeed, which still is the rest of the string.
|
|---|