From 94e4a95f9bf22789174af43fc803a52c131d7aa9 Mon Sep 17 00:00:00 2001 From: gorhill Date: Sat, 5 Dec 2015 01:28:17 -0500 Subject: [PATCH] this further fix #997: no need to use `/` for leading `*` --- src/js/static-net-filtering.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 0da57f70a..d5ddb3748 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -1622,8 +1622,10 @@ FilterParser.prototype.parse = function(raw) { // TODO: transforming `^` into `*` is not a strict interpretation of // ABP syntax. if ( this.reHasWildcard.test(s) ) { + s = s.replace(/^\*+([^%0-9a-z])/, '$1') // remove pointless leading * + .replace(/([^%0-9a-z])\*+$/, '$1'); // remove pointless trailing * + s = trimChar(s, '^'); s = s.replace(/\^/g, '*').replace(/\*\*+/g, '*'); - s = trimChar(s, '*'); } // nothing left?