privoxy-regression-test.pl: Fix a sentence in the documentation
[privoxy.git] / tools / url-pattern-translator.pl
index f159fb0..0653e76 100755 (executable)
@@ -18,8 +18,6 @@
 # Only convert your files once, or, as RoboCop used to say,
 # there will be... trouble.
 #
-# $Id: url-pattern-translator.pl 1.9 2008/04/06 16:01:49 fk Exp $
-#
 # Copyright (c) 2008 Fabian Keil <fk@fabiankeil.de>
 #
 # Permission to use, copy, modify, and distribute this software for any
@@ -63,20 +61,16 @@ sub convert_host_pattern ($) {
     }
 
     # Match-all syntax has changed ...
-    $hp =~ s@\*@.*@g;
+    $hp =~ s@\*@[^.]*@g;
 
-    if ($hp =~ m@\.$@) {
-        # Extended host patterns are right-anchored by default
-        $hp = $hp . '.*';
-    }
+    # Extended host patterns are right-anchored by default
+    $hp =~ s@\.$@(\..*)?@;
 
     # Literal dots have to be escaped    
-    $hp =~ s@(\.[^*])@\\$1@g;
+    $hp =~ s@((?<!\\)\.[^*])@\\$1@g;
 
     # Match single character with a dot.
-    $hp =~ s@\?@.@g;
-
-    #p("converted $host_pattern to: $hp");
+    $hp =~ s@(?<!\))\?@.@g;
 
     return $hp;
 }
@@ -105,9 +99,13 @@ sub looks_interesting($) {
 
         $type_to_skip = "macro or version definition";
 
+    } elsif (m@^\s*standard\.@) {
+
+        $type_to_skip = "predefined settings";
+
     }
 
-    #p("Skipping " . $type_to_skip . ": " . $_);
+    #p("Skipping " . $type_to_skip . ": " . $_) if defined $type_to_skip;
 
     return not defined $type_to_skip;
 }