I have this Regex Expression that works in chrome but doesn't not work in Firefox. SyntaxError: invalid regexp group
It has something to do with lookbehinds and Firefox does not support these. I need this to work in Firefox can some one help me convert this so it works in Firefox and filters out the tags as well?
return new RegExp(`(?!<|>|/|&|_)(?<!</?[^>]*|&[^;]*)(${term})`, 'gi');
};
searchTermsInArray.forEach(term => {
if (term.length) {
const regexp = this.regexpFormula(term);
newQuestion.qtiData.prompt = newQuestion.qtiData.prompt.replace(regexp, match => {
return `<span class="highlight">${match}</span>`;
});```
In chrome it filters out the html tags and returns the search term with a <span class="highlight">.