Skip to content

Commit

Permalink
fix(recent-searches): escape highlighted query regex (#387)
Browse files Browse the repository at this point in the history
* Fix special char escaping for highlighted recent searches
  • Loading branch information
shortcuts committed Jan 12, 2021
1 parent e144764 commit d23f133
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function highlight<TItem extends RecentSearchesItem>({
query: {
value: query
? item.query.replace(
new RegExp(query, 'g'),
new RegExp(query.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'),
`__aa-highlight__${query}__/aa-highlight__`
)
: item.query,
Expand Down

0 comments on commit d23f133

Please sign in to comment.