1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00
gorhill 2015-07-04 17:34:18 -04:00
parent 03093b91eb
commit dd394ebba5

View File

@ -193,9 +193,10 @@ var strToRegex = function(s, anchor, flags) {
return alwaysTruePseudoRegex;
}
// 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, '.*');
.replace(/\*/g, '[^ ]*?');
if ( anchor < 0 ) {
reStr = '^' + reStr;