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:
parent
d170d67001
commit
6eda7e9f18
1 changed files with 2 additions and 0 deletions
|
@ -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/;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue