From fe305074f1b2cf9d02efec214f699e44ce0c1e3f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 7 Jan 2015 11:30:15 -0600 Subject: [PATCH] escape pattern unless it's prefixed with ~ --- support-d/utils/hashfinder | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/support-d/utils/hashfinder b/support-d/utils/hashfinder index f6ec9df3e4..88df4ce5cc 100755 --- a/support-d/utils/hashfinder +++ b/support-d/utils/hashfinder @@ -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;