1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 19:26:05 -04:00

remove the \ on \$ when substituting

This commit is contained in:
Ryan Voots 2010-03-12 17:32:22 -05:00
parent d170d67001
commit 6eda7e9f18

View file

@ -343,6 +343,7 @@ sub _fact_substitute
my @caps = map {substr($pred, $-[$_], $+[$_] - $-[$_])} 1..$#+;
my $realsubst = $subst;
$realsubst =~ s/(?<!\\)\$(?:\{(\d+)\}|(\d+))/$caps[$1-1]/eg;
$realsubst =~ s/\\(?=\$)//g;
substr $pred, $matchstart, $matchend-$matchstart, $realsubst;
pos $pred = $matchstart+length($realsubst); #set the new position, might have an off by one?
@ -359,6 +360,7 @@ sub _fact_substitute
my @caps = map {substr($pred, $-[$_], $+[$_] - $-[$_])} 1..$#+;
my $realsubst = $subst;
$realsubst =~ s/(?<!\\)\$(?:\{(\d+)\}|(\d+))/$caps[$1-1]/eg;
$realsubst =~ s/\\(?=\$)//g;
$pred =~ s/$regex/$realsubst/;
}