returning a variable in a span elements it is returning the variable as a string

I have the following code is there anyway to use a variable in it? It is returning the variable as a string and not returning the value of the variable.


 replace = replace.replace(new RegExp(amerMatch[i] + "\.", "i"), `<span class="highlight">library[amerMatch[i]]</span>` + ".")

result:

Can you toss this in the library[amerMatch[i]] for me?