samedi 3 janvier 2015

Javascript replacing double backslashed with single backslash

I have been browsing lots of solutions, but somewhy haven't got anything to work.


I need to replace following string: "i:0#.w|dev\\tauri;" with "i:0#.w|dev\tauri;"


I have tried following JS codes to replace:



s.replace(/\\\\/g, "\\$1");

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


But have had no result. Yet following replaced my \\ with "



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


To be honset, then I am really confused behind this logic, it seems like there should be used \\\\ for double backshashed yet it seems to work with just \\ for two backshashes..


I need to do this for comparing if current Sharepoint user (i:0#.w|dev\tauri) is on the list.


Aucun commentaire:

Enregistrer un commentaire