3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02: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 $text = "@_";
if ($text =~ /^s(.)(.*?)(?<!\\)\1(.*?)(?<!\\)\1(\S*)\s+(.*)/p) {
my ($a, $r, $g, $m, $t) = ($5,"'\"$3\"'", index($4,"g") != -1, $4, $2);
if ($text =~ /^s(.)(.*?)(?<!\\)\1(.*?)(?<!\\)\1(\S*)\s+(.*)/p) {
my ($a, $r, $g, $m, $t) = ($5,"'\"$3\"'", index($4,"g") != -1, $4, $2);
if ($m=~/P/) {
$r =~ s/^'"(.*)"'$/$1/;
$m=~s/P//g;
if ($m=~/P/) {
$r =~ s/^'"(.*)"'$/$1/;
$m=~s/P//g;
if($g) {
$a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|gie;
} else {
$a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|ie;
}
} else {
if ($g) {
$a =~ s/(?$m)$t/$r/geee;
} else {
$a=~s/(?$m)$t/$r/eee;
}
}
return $a;
} else {
return "sed: syntax error";
}
if($g) {
$a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|gie;
} else {
$a =~ s|(?$m)($t)|$1=~/^[A-Z][^A-Z]/?ucfirst$r:($1=~/^[A-Z]+$/?uc$r:$r)|ie;
}
} else {
if ($g) {
$a =~ s/(?$m)$t/$r/geee;
} else {
$a=~s/(?$m)$t/$r/eee;
}
}
return $a;
} else {
return "sed: syntax error";
}
}
use warnings;