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.
1 parent 49f7046 commit ccf9f1fCopy full SHA for ccf9f1f
src/components/search/search-item.tsx
@@ -53,7 +53,8 @@ export const HighlightedText: FunctionComponent<HighlightedTextProps> = ({
53
text,
54
highlight,
55
}) => {
56
- const parts = text.split(new RegExp(`(${highlight})`, 'gi'));
+ const escapedHighlight = highlight.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
57
+ const parts = text.split(new RegExp(`(${escapedHighlight})`, 'gi'));
58
return (
59
<span>
60
{parts.map((part, i) =>
0 commit comments