Index: lib/filterClasses.js |
=================================================================== |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -489,25 +489,18 @@ |
get regexp() |
{ |
// Remove multiple wildcards |
- let source = this.regexpSource.replace(/\*+/g, "*"); |
- |
- // Remove leading wildcards |
- if (source[0] == "*") |
- source = source.substr(1); |
- |
- // Remove trailing wildcards |
- let pos = source.length - 1; |
- if (pos >= 0 && source[pos] == "*") |
- source = source.substr(0, pos); |
- |
- source = source.replace(/\^\|$/, "^") // remove anchors following separator placeholder |
- .replace(/\W/g, "\\$&") // escape special symbols |
- .replace(/\\\*/g, ".*") // replace wildcards by .* |
- // process separator placeholders (all ANSI charaters but alphanumeric characters and _%.-) |
- .replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\x60\\x7B-\\x80]|$)") |
- .replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^.\\/]+\\.)*?") // process extended anchor at expression start |
- .replace(/^\\\|/, "^") // process anchor at expression start |
- .replace(/\\\|$/, "$"); // process anchor at expression end |
+ let source = this.regexpSource |
+ .replace(/\*+/g, "*") // remove multiple wildcards |
+ .replace(/\^\|$/, "^") // remove anchors following separator placeholder |
+ .replace(/\W/g, "\\$&") // escape special symbols |
+ .replace(/\\\*/g, ".*") // replace wildcards by .* |
+ // process separator placeholders (all ANSI characters but alphanumeric characters and _%.-) |
+ .replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\x60\\x7B-\\x80]|$)") |
Wladimir Palant
2014/01/27 14:06:53
Nothing wrong with having \\x7F instead of \\x80 h
|
+ .replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?") // process extended anchor at expression start |
+ .replace(/^\\\|/, "^") // process anchor at expression start |
+ .replace(/\\\|$/, "$") // process anchor at expression end |
+ .replace(/^(\.\*)/, "") // remove leading wildcards |
+ .replace(/(\.\*)$/, ""); // remove trailing wildcards |
let regexp = new RegExp(source, this.matchCase ? "" : "i"); |