From ea637b0a1cfaf93d718e836e50d5cbe0712ff0e8 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Thu, 1 Dec 2022 13:16:10 -0500 Subject: [PATCH] Fix regex issues --- website/src/components/layout/search/SearchModal.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/src/components/layout/search/SearchModal.tsx b/website/src/components/layout/search/SearchModal.tsx index 7ee7f51d..c452d01a 100644 --- a/website/src/components/layout/search/SearchModal.tsx +++ b/website/src/components/layout/search/SearchModal.tsx @@ -120,7 +120,7 @@ const SearchModal: FC = ({ open, onClose, searchablePages }) = if (!result.isExactTitleMatch) { const match = new RegExp( - `(?:[\\s]+[^\\s]+){0,10}[\\s]*${search}(?![^<>]*(([/"']|]]|\b)>))[\\s]*(?:[^\\s]+\\s){0,25}`, + `(?:[\\s]+[^\\s]+){0,10}[\\s]*${search}(?![^<>]*(([/"']|]]|\\b)>))[\\s]*(?:[^\\s]+\\s){0,25}`, 'ig', ).exec(entry.textContent); if (match && match.length >= 1) { @@ -129,7 +129,7 @@ const SearchModal: FC = ({ open, onClose, searchablePages }) = const match = new RegExp( `(?:[\\s]+[^\\s]+){0,10}[\\s]*(${search .split(' ') - .join('|')})(?![^<>]*(([/"']|]]|\b)>))[\\s]*(?:[^\\s]+\\s){0,25}`, + .join('|')})(?![^<>]*(([/"']|]]|\\b)>))[\\s]*(?:[^\\s]+\\s){0,25}`, 'ig', ).exec(entry.textContent); if (match && match.length >= 1) { @@ -139,7 +139,7 @@ const SearchModal: FC = ({ open, onClose, searchablePages }) = } summary = summary?.replace( - new RegExp(`(${search.split(' ').join('|')})(?![^<>]*(([/"']|]]|\b)>))`, 'ig'), + new RegExp(`(${search.split(' ').join('|')})(?![^<>]*(([/"']|]]|\\b)>))`, 'ig'), `$1`, );