escape pattern unless it's prefixed with ~

This commit is contained in:
Anthony Minessale 2015-01-07 11:30:15 -06:00
parent 19a0a0fb00
commit fe305074f1

View File

@ -48,8 +48,11 @@ sub doit($$) {
my $loops = shift || 0; my $loops = shift || 0;
my $linematch = 0; my $linematch = 0;
$pattern =~ s/\(/\\\(/g; if ($pattern =~ /^\~(.*)/) {
$pattern =~ s/\)/\\\)/g; $pattern = $1;
} else {
$pattern = quotemeta $pattern;
}
if ($pattern =~ /^(\d+)$/) { if ($pattern =~ /^(\d+)$/) {
$linematch = 1; $linematch = 1;