3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02:00

Plugins/TypoSub: support $1 and \1 capture replacements

This commit is contained in:
Pragmatic Software 2020-02-09 23:35:59 -08:00
parent 70abebeb90
commit 410ce811ca

View File

@ -79,8 +79,14 @@ sub on_public {
my $text = $message->{msg};
if ($modifiers =~ m/g/) {
$text =~ s/$rx/$replacement/g;
my @stuff = ($1, $2, $3, $4, $5, $6, $7, $8, $9);
my $i;
map { ++$i; $text =~ s/[\$\\]$i/$_/g; } @stuff;
} else {
$text =~ s/$rx/$replacement/;
my @stuff = ($1, $2, $3, $4, $5, $6, $7, $8, $9);
my $i;
map { ++$i; $text =~ s/[\$\\]$i/$_/g; } @stuff;
}
$event->{conn}->privmsg($channel, "$result$text");
return 0;