From 9ac84f9171374a7045342522bc30130d2d131ba8 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 6 Nov 2015 10:49:09 -0500 Subject: [PATCH] this fixes #842 --- src/js/static-net-filtering.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 6ce4f14c6..ee36666bb 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -1539,10 +1539,15 @@ FilterParser.prototype.parse = function(raw) { } // options - pos = s.indexOf('$'); - if ( pos !== -1 ) { - this.parseOptions(s.slice(pos + 1)); - s = s.slice(0, pos); + // https://github.com/gorhill/uBlock/issues/842 + // - ensure sure we are not dealing with a regex-based filter. + // - lookup the last occurrence of `$`. + if ( s.charAt(0) !== '/' || s.slice(-1) !== '/' ) { + pos = s.lastIndexOf('$'); + if ( pos !== -1 ) { + this.parseOptions(s.slice(pos + 1)); + s = s.slice(0, pos); + } } // regex?