Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace Special Characters

i want to replace escape character(\)in the path to single \ in js

\\cpmp1\D$\\ABC\\XYZ

i tried

console.log(s.replace(/.\\\\/g, '\\'));

but it does not do any replace ?Any ideas ?

like image 242
user415772 Avatar asked Nov 14 '11 14:11

user415772


Video Answer


1 Answers

var replacedStr = s.replace(/\\+/g, '\\');
like image 182
Royi Namir Avatar answered Oct 09 '22 21:10

Royi Namir