Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Replace '\' with '\\'

Cindy Sim
Tera Expert

I need to replace '\' with '\\'. How can we do it? Currently I am using :

replace("\", "\\"));
10 REPLIES 10

Trupti94
Kilo Sage
Kilo Sage

Hi @Cindy Sim ,

 

can you please try below function

replace(/\\/g, "\\\\");

 

Thanks,

Trupti