Hi friends,
Using following Javascript sysntax you can replace forward slashes (‘/’) with backward slashes (‘\’) :
var strReplace = “C:\Temp\Temp1\Temp2\text.jpeg“;
strReplace = strReplace.replace(new RegExp(/\\/g),”/”);
Regardes,
Vijay
Hi friends,
Using following Javascript sysntax you can replace forward slashes (‘/’) with backward slashes (‘\’) :
var strReplace = “C:\Temp\Temp1\Temp2\text.jpeg“;
strReplace = strReplace.replace(new RegExp(/\\/g),”/”);
Regardes,
Vijay
Javascript String Replace Path
Thanks a lot for the valuable solutions.
Nice Code, Thanks a lot
Hi, how would it be shifted, I mean, Replace backward slashes ‘\’ with forward slashes ‘/’.
That is right, your description is wrong, you are replacing \ for /….
what about the opposite one, how could it be done?
Use this to replace “/” with “\”. The code may not look right depending on your code editor, but it’ll work.
oops, forgot to add the code:
strReplace = strReplace.replace(/\//g, “\\”);
Here is the code you guys are asking for:
strReplace = strReplace.replace(/\//g, “\\”);
Hi Lou,
this doesn´t work with the built-in Javasript of Adobe Acrobat (V. 9.3). Do you have a solution for the Adobe crippled Javascript?
Pingback: Punkchip | Removing forward slashes from a string
Thank you I looked all over for this. So simple in vb
got error invalid expression