How to highlight text in repeater search results

Figured it out, just changed it from text.replace() to html.replace(). Thanks again Velo-Ninja for your input!

$w ( ‘#GlossaryRepeater’ ). forEachItem (( $item , itemData )=>{
let searchInput = $w ( ‘#SearchBar’ ). value
const searchResult = new RegExp ( searchInput , “gi” );
let newText = $item ( ‘#definitionText’ ). html . replace ( searchResult , ( match ) => <mark> ${ match } </mark> )

$item ( '#definitionText' ). html  =  newText 
})