diff --git a/src/components/Question.js b/src/components/Question.js index 69ea0d2..511caca 100644 --- a/src/components/Question.js +++ b/src/components/Question.js @@ -4,8 +4,12 @@ function highlightText(text, toHighlight) { if (!text) { return '' } - const re = new RegExp(toHighlight, 'gi') - return text.replace(re, `${toHighlight}`) + try { + const re = new RegExp(toHighlight, 'gi') + return text.replace(re, `${toHighlight}`) + } catch (e) { + return text + } } export default function Question({ question, searchTerm }) {