diff --git a/modules/c11std.pl b/modules/c11std.pl index b8d1d67e..f243f37d 100755 --- a/modules/c11std.pl +++ b/modules/c11std.pl @@ -86,7 +86,9 @@ if($list_only) { $result = "Sections containing '$search':\n "; } -$search =~ s/\s/\\s+/g; +my $qsearch = quotemeta $search; +$qsearch =~ s/\\ / /g; +$qsearch =~ s/\s+/\\s+/g; while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { $this_section = $1; @@ -138,7 +140,7 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { if(length $search) { eval { - if($t =~ m/\b$search/mis or $section_title =~ m/\b$search/mis) { + if($t =~ m/\b$qsearch\b/mis or $section_title =~ m/\b$qsearch\b/mis) { $matches++; if($matches >= $match) { if($list_only) { diff --git a/modules/c99std.pl b/modules/c99std.pl index 65c86b25..95f2103b 100755 --- a/modules/c99std.pl +++ b/modules/c99std.pl @@ -86,7 +86,9 @@ if($list_only) { $result = "Sections containing '$search':\n "; } -$search =~ s/\s/\\s+/g; +my $qsearch = quotemeta $search; +$qsearch =~ s/\\ / /g; +$qsearch =~ s/\s+/\\s+/g; while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { $this_section = $1; @@ -137,7 +139,7 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { if(length $search) { eval { - if($t =~ m/\b$search/mis or $section_title =~ m/\b$search/mis) { + if($t =~ m/\b$qsearch\b/mis or $section_title =~ m/\b$qsearch\b/mis) { $matches++; if($matches >= $match) { if($list_only) {