mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 17:49:39 +02:00
this fixes #1064
This commit is contained in:
parent
33291c4dca
commit
af4dba5158
@ -283,6 +283,7 @@ var filterDecompiler = (function() {
|
||||
return filter;
|
||||
};
|
||||
|
||||
var reEscapeHostname = /[.[\]]/g;
|
||||
var reEscape = /[.+?${}()|[\]\\]/g;
|
||||
var reWildcards = /\*+/g;
|
||||
var reSeparator = /\^/g;
|
||||
@ -295,7 +296,8 @@ var filterDecompiler = (function() {
|
||||
|
||||
switch ( fid ) {
|
||||
case '.':
|
||||
reStr = vfields[2].replace(reEscape, '\\$&');
|
||||
reStr = vfields[2].replace(reEscapeHostname, '\\$&') +
|
||||
'(?:[^%.0-9a-z_-]|$)';
|
||||
break;
|
||||
case 'a':
|
||||
case 'ah':
|
||||
@ -316,7 +318,7 @@ var filterDecompiler = (function() {
|
||||
reStr = tfields[0]
|
||||
.replace(reEscape, '\\$&')
|
||||
.replace(reWildcards, '.*')
|
||||
.replace(reSeparator, '[^%.0-9a-z_-]');
|
||||
.replace(reSeparator, '(?:[^%.0-9a-z_-]|$)');
|
||||
break;
|
||||
case '//':
|
||||
case '//h':
|
||||
|
@ -208,7 +208,7 @@ var strToRegex = function(s, anchor, flags) {
|
||||
// https://www.loggly.com/blog/five-invaluable-techniques-to-improve-regex-performance/
|
||||
// https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions
|
||||
var reStr = s.replace(/[.+?${}()|[\]\\]/g, '\\$&')
|
||||
.replace(/\^/g, '[^%.0-9a-z_-]')
|
||||
.replace(/\^/g, '(?:[^%.0-9a-z_-]|$)')
|
||||
.replace(/\*/g, '[^ ]*?');
|
||||
|
||||
if ( anchor < 0 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user