mirror of
https://github.com/perlbot/perlbuut
synced 2025-06-07 22:45:45 -04:00
making some enhancements to the $1 code, to accept \$1 and ${1} correctly
This commit is contained in:
parent
46e20d0106
commit
d170d67001
1 changed files with 2 additions and 2 deletions
|
@ -342,7 +342,7 @@ sub _fact_substitute
|
|||
my ($matchstart, $matchend) = ($-[0], $+[0]);
|
||||
my @caps = map {substr($pred, $-[$_], $+[$_] - $-[$_])} 1..$#+;
|
||||
my $realsubst = $subst;
|
||||
$realsubst =~ s/\$(\d+)/$caps[$1-1]/eg;
|
||||
$realsubst =~ s/(?<!\\)\$(?:\{(\d+)\}|(\d+))/$caps[$1-1]/eg;
|
||||
|
||||
substr $pred, $matchstart, $matchend-$matchstart, $realsubst;
|
||||
pos $pred = $matchstart+length($realsubst); #set the new position, might have an off by one?
|
||||
|
@ -358,7 +358,7 @@ sub _fact_substitute
|
|||
{
|
||||
my @caps = map {substr($pred, $-[$_], $+[$_] - $-[$_])} 1..$#+;
|
||||
my $realsubst = $subst;
|
||||
$realsubst =~ s/\$(\d+)/$caps[$1-1]/eg;
|
||||
$realsubst =~ s/(?<!\\)\$(?:\{(\d+)\}|(\d+))/$caps[$1-1]/eg;
|
||||
|
||||
$pred =~ s/$regex/$realsubst/;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue