3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

FuncCommand: replace tabs with spaces

This commit is contained in:
Pragmatic Software 2019-08-24 19:29:14 -07:00
parent d9728d3693
commit 84fcc7fd66

View File

@ -132,29 +132,29 @@ sub func_sed {
my $self = shift; my $self = shift;
my $text = "@_"; my $text = "@_";
if ($text =~ /^s(.)(.*?)(?<!\\)\1(.*?)(?<!\\)\1(\S*)\s+(.*)/p) { if ($text =~ /^s(.)(.*?)(?<!\\)\1(.*?)(?<!\\)\1(\S*)\s+(.*)/p) {
my ($a, $r, $g, $m, $t) = ($5,"'\"$3\"'", index($4,"g") != -1, $4, $2); my ($a, $r, $g, $m, $t) = ($5,"'\"$3\"'", index($4,"g") != -1, $4, $2);
if ($m=~/P/) { if ($m=~/P/) {
$r =~ s/^'"(.*)"'$/$1/; $r =~ s/^'"(.*)"'$/$1/;
$m=~s/P//g; $m=~s/P//g;
if($g) { if($g) {
$a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|gie; $a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|gie;
} else { } else {
$a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|ie; $a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|ie;
} }
} else { } else {
if ($g) { if ($g) {
$a =~ s/(?$m)$t/$r/geee; $a =~ s/(?$m)$t/$r/geee;
} else { } else {
$a=~s/(?$m)$t/$r/eee; $a=~s/(?$m)$t/$r/eee;
} }
} }
return $a; return $a;
} else { } else {
return "sed: syntax error"; return "sed: syntax error";
} }
} }
use warnings; use warnings;