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
1 changed files with 5 additions and 2 deletions

View File

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