From 9276504e21c5d5925c30b5d40c08b73aa25c13de Mon Sep 17 00:00:00 2001 From: shortcuts Date: Mon, 11 Jan 2021 17:54:33 +0100 Subject: [PATCH] Use RegExp instead of replaceAll --- .../src/usecases/localStorage/search.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/autocomplete-plugin-recent-searches/src/usecases/localStorage/search.ts b/packages/autocomplete-plugin-recent-searches/src/usecases/localStorage/search.ts index 27da1afbd..086dbf831 100644 --- a/packages/autocomplete-plugin-recent-searches/src/usecases/localStorage/search.ts +++ b/packages/autocomplete-plugin-recent-searches/src/usecases/localStorage/search.ts @@ -14,8 +14,8 @@ function highlight({ _highlightResult: { query: { value: query - ? item.query.replaceAll( - query, + ? item.query.replace( + new RegExp(query.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), `__aa-highlight__${query}__/aa-highlight__` ) : item.query,