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

Side by Side Diff: lib/matcher.js

Issue 29768690: Noissue - Compare individual characters instead of substring (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created May 2, 2018, 11:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 let {text} = filter; 115 let {text} = filter;
116 if (Filter.regexpRegExp.test(text)) 116 if (Filter.regexpRegExp.test(text))
117 return result; 117 return result;
118 118
119 // Remove options 119 // Remove options
120 let match = Filter.optionsRegExp.exec(text); 120 let match = Filter.optionsRegExp.exec(text);
121 if (match) 121 if (match)
122 text = match.input.substr(0, match.index); 122 text = match.input.substr(0, match.index);
123 123
124 // Remove whitelist marker 124 // Remove whitelist marker
125 if (text.substr(0, 2) == "@@") 125 if (text[0] == "@" && text[1] == "@")
126 text = text.substr(2); 126 text = text.substr(2);
127 127
128 let candidates = text.toLowerCase().match( 128 let candidates = text.toLowerCase().match(
129 /[^a-z0-9%*][a-z0-9%]{3,}(?=[^a-z0-9%*])/g 129 /[^a-z0-9%*][a-z0-9%]{3,}(?=[^a-z0-9%*])/g
130 ); 130 );
131 if (!candidates) 131 if (!candidates)
132 return result; 132 return result;
133 133
134 let hash = this.filterByKeyword; 134 let hash = this.filterByKeyword;
135 let resultCount = 0xFFFFFF; 135 let resultCount = 0xFFFFFF;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 return result; 425 return result;
426 } 426 }
427 }; 427 };
428 428
429 /** 429 /**
430 * Shared CombinedMatcher instance that should usually be used. 430 * Shared CombinedMatcher instance that should usually be used.
431 * @type {CombinedMatcher} 431 * @type {CombinedMatcher}
432 */ 432 */
433 exports.defaultMatcher = new CombinedMatcher(); 433 exports.defaultMatcher = new CombinedMatcher();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld