mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 11:42:35 +01:00
Plugins/TypoSub: support $1 and \1 capture replacements
This commit is contained in:
parent
70abebeb90
commit
410ce811ca
@ -79,8 +79,14 @@ sub on_public {
|
|||||||
my $text = $message->{msg};
|
my $text = $message->{msg};
|
||||||
if ($modifiers =~ m/g/) {
|
if ($modifiers =~ m/g/) {
|
||||||
$text =~ s/$rx/$replacement/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 {
|
} else {
|
||||||
$text =~ s/$rx/$replacement/;
|
$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");
|
$event->{conn}->privmsg($channel, "$result$text");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user