I'm attempting to replace all instances of a string within a variable, but the string I'm looking for is also a variable. How can I add this string within a regex?
var myVar = HelloWorldHello;
var myString = Hello;
myVar = myVar.replace(/\\' + myString + '/g, '');
The above doesn't seem to be working. I need to end up with World
.