i am trying to replace all references to a keyword or number in a string to something else, i am able to do this using the following, but need the /g to make sure it changes all references. However i want to make it dynamic, change the first number to a varible, and then put that varible inbetween the forward slash but it wont work.
works
var res = str.replace(/5026555042451/g, "34234324");
doesnt work
var customstring = "5026555042451";
var res = str.replace(/+customstring+/g, "34234324");