How to return a variable

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>` + ".")


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

${var} worked
I haven’t used template literals much.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.