I'm trying to replace the token "[RANDOMNUMBER]" in a string but my code is not working? The regex shows as valid when checking on online validation tools? I know it has to be a stupid mistake but I don't see it?
function detokenizeTags(imgSrc){
var rn = Math.random() + "",
rnd = rn * 10000000000000;
imgSrc.replace(/\[RANDOMNUMBER\]/g,rnd);
return imgSrc;
}
sample input string: //ad.amgdgt.com/ads/?t=ap&px=79079&rndn=[RANDOMNUMBER]