Click to See Complete Forum and Search --> : Regular expression in javascript string replace()


0xC0000005
June 15th, 2009, 01:35 PM
I am trying to replace all backslashes in a path with forward slashes. First, I'm not even sure if this is the best method to use, but it doesn't seem to work and I can't figure out why. The call to replace() below does not replace backslashes.

<%
function GetTranslatedPath()
{
var path = String(Request.ServerVariables("PATH_TRANSLATED"));
path.replace(/\\/g, "/");
return path;
}
%>