I have this code:
$(this).html(html.replace(/"expedita"/gi, '<strong>$&</strong>'));
which is working but the string to replace is hardcoded, I need to be able to insert a variable
$(this).html(html.replace(/"+search+"/gi, '<strong>$&</strong>'));
search is a variable I have assigned a value I want to replace, but this code is not working, it seems i can't insert a variable into regex expression.
How can I use regex but not have a hardcoded word and be able to use any word?