Highlight certain words in Text

@hello67029
Yeah i am glad that i could help you, but i am still struggling with one issue.
Perhaps you can now help me xDDDDD😂

It seems like you are working with REGX, i am not good in it.

My problem is surely a very simple one.
Let use the same example with the search of the word —> and

Can’t figure out, how to set a variable instea of —> “and”

let res2 = str.replace(/and/gi, `<mark>${searchWord}</mark>`);

i need this…

let searchWord = $w('#input1').value
let res2 = str.replace(/searchWord/gi, `<mark>${searchWord}</mark>`);

Can not find the right syntax to implement a variable into the replace-command.