Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 /** | 20 /** |
21 * Convert raw text into a regular expression string | 21 * Converts raw text into a regular expression string |
Manish Jethani
2018/02/22 07:08:27
Sorry, for consistency, can we say "Converts" inst
hub
2018/02/22 14:07:49
Done.
| |
22 * @param {string} text the string to convert. | 22 * @param {string} text the string to convert |
Manish Jethani
2018/02/22 07:08:27
Nit: seems like we generally don't add periods at
hub
2018/02/22 14:07:49
Done.
| |
23 * @return {string} regular expression representation of string match. | 23 * @return {string} regular expression representation of the text |
Manish Jethani
2018/02/22 07:08:28
"string match" seems to imply something, do you th
hub
2018/02/22 14:07:50
Done.
| |
24 */ | 24 */ |
25 function textToRegExp(text) | 25 function textToRegExp(text) |
26 { | 26 { |
27 return text.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); | 27 return text.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); |
28 } | 28 } |
29 | 29 |
30 exports.textToRegExp = textToRegExp; | 30 exports.textToRegExp = textToRegExp; |
31 | 31 |
32 /** | 32 /** |
33 * Converts filter text into regular expression string | 33 * Converts filter text into regular expression string |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 start = i + 1; | 94 start = i + 1; |
95 } | 95 } |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 selectors.push(selector.substring(start)); | 99 selectors.push(selector.substring(start)); |
100 return selectors; | 100 return selectors; |
101 } | 101 } |
102 | 102 |
103 exports.splitSelector = splitSelector; | 103 exports.splitSelector = splitSelector; |
LEFT | RIGHT |