Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterClasses.js

Issue 4922123285954560: Fixed: Pipe in filter interpreted wrong when wildcards stripped away (Closed)
Patch Set: Created Jan. 24, 2014, 2:33 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld