diff --git a/.eslintrc.json b/.eslintrc.json index 1139942..13c1704 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -87,7 +87,13 @@ "no-use-before-define": "error", "no-useless-call": "error", "no-useless-concat": "error", - "one-var": "error", + "one-var": [ + "error", + { + "var": "always", + "let": "always" + } + ], "one-var-declaration-per-line": [ "error", "always" diff --git a/paper-autocomplete-chips.html b/paper-autocomplete-chips.html index 87cf1d4..e5945b6 100644 --- a/paper-autocomplete-chips.html +++ b/paper-autocomplete-chips.html @@ -255,7 +255,8 @@ continue; } - result.html = result.text.replace(new RegExp('(' + query + ')', 'ig'), regexpResult); + const escapedQuery = query.replace(/[|\\{}()[\]^$+*?.-]/gu, '\\$&'); + result.html = result.text.replace(new RegExp('(' + escapedQuery + ')', 'ig'), regexpResult); results.push(result); if (results.length >= maxResults) {