I have a string that is being concatenated as such

site_address = site_address.replace("'", "\'");
site_name = site_name.replace("'", "\'");

htmlOutput= htmlOutput +"<a href = \'javascript:helperFuncs.panZoomToFeature(\"" + site_name + "\",\"" + site_address + "\",\"" + "\");\'>" + site_name + "</a>";

The problem is the single quotes are not getting escaped. I tried a regex and that didn't work either.

Does anyone know what is going on here?

Thanks