We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 365717f + 012eaf6 commit 4bd31cdCopy full SHA for 4bd31cd
common/content/hints.js
@@ -846,13 +846,18 @@ const Hints = Module("hints", {
846
* found in the link.
847
*/
848
function fuzzyMatcher(hintString) {
849
- expression = '';
+ var expression = '';
850
851
// Build a regex for fuzzy matching with the input.
852
//
853
// If the input is 'abc', the regex will be '[^a]*a[^b]*b[^c]c'.
854
- for (var i = 0; i < hintString.length; i ++) {
+ var escapeChar = new Set("()[{?.*+^$|\\");
855
+ for (var i = 0, j = hintString.length; i < j; i ++) {
856
var char = hintString[i];
857
+
858
+ if (escapeChar.has(char))
859
+ char = "\\" + char;
860
861
expression += '[^' + char + ']*' + char;
862
}
863
0 commit comments