TT#14360 correctly treat replacement pattern \0

from perl core documentation:
> $& returns the entire matched string.
> (At one point $0 did also, but now it returns the name of the program.)

Change-Id: Ia884ac758c91da7e365f609c2d5f0dbe784e763b
changes/66/12666/2
Gerhard Jungwirth 9 years ago
parent 7a16cf3cc7
commit 03e1614299

@ -1489,7 +1489,10 @@ sub apply_rewrite {
$match = [ $match ] if(ref $match ne "ARRAY");
$replace = shift @{ $replace } if(ref $replace eq "ARRAY");
# \1 => ${1}
$replace =~ s/\\(\d{1})/\${$1}/g;
# ${0} => ${&} # meaning the whole matched regex (compatible to sed/POSIX)
$replace =~ s/\$\{0\}/\${&}/g;
$replace =~ s/\"/\\"/g;
$replace = qq{"$replace"};

Loading…
Cancel
Save