summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMyProxy.pl10
-rw-r--r--adzap/scripts/prematch.list2
2 files changed, 9 insertions, 3 deletions
diff --git a/MyProxy.pl b/MyProxy.pl
index f7af9fb..df1cda4 100755
--- a/MyProxy.pl
+++ b/MyProxy.pl
@@ -27,10 +27,13 @@ sub subptn2re {
sub ptn2re {
my ($pat)=@_;
- $pat=~s|([.\@\%\$?+])|\\$1|g; # quote specials
+ $pat=~s|([.\@\%\$+])|\\$1|g; # quote specials
+ $pat=~s|([^(])(\?)|$1\\$2|g; # quote some question marks
$pat=~s|/+|/+|g; # turn slashes into "/+"
$pat=~s:(\\.|[^*\\]|\*+):subptn2re($1):ge; # expand wildcards
- return qr{^$pat$};
+ my $ret=eval{qr{^$pat$}};
+ return if $@;
+ return $ret;
}
my %ACTIONS=(
@@ -68,7 +71,8 @@ sub addPattern {
$addPatternLogger->error("Unknown action $action, skipping");
return;
}
- push @PATTERNS,[ptn2re($match),@{$ACTIONS{$action}},@parms];
+ my $re=ptn2re($match);
+ push @PATTERNS,[$re,@{$ACTIONS{$action}},@parms] if $re;
}
my $loadPatternsLogger=Log::Log4perl->get_logger('MyProxy.load.loadPatterns');
diff --git a/adzap/scripts/prematch.list b/adzap/scripts/prematch.list
index 89c3115..426d629 100644
--- a/adzap/scripts/prematch.list
+++ b/adzap/scripts/prematch.list
@@ -7,3 +7,5 @@ PRINT http://(www*.|)wired.com/wired/archive/([^p]**)(?<!_pr).html** http://www.
PRINT http://(www*.|)wired.com/news/[^p]*/0,*,(*),00.html** http://www.wired.com/news/print/0,1294,$2,00.html
PRINT (http://*.boston.com/**/articles/[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/*/)(|?)** $1?mode=PF
COUNTERJS http://*/**counter**.js
+PRINT http://(www*.|)nytimes.com/(aponline|20[0-9][0-9]/[01][0-9]/[0-3][0-9])/**.html?**(?<!print) $&&pagewanted=print
+PASS http://(www*.|)nytimes.com/(aponline|20[0-9][0-9]/[01][0-9]/[0-3][0-9])/**.html?**print