I am trying to replace a string (/\) in JavaScript with Forward slash (/).
For example, this: uploads/\images\cats\rr.jpg should become this: uploads/imagescats/rr.jpg
I tried string.replace(/\\/g,""); but is replacing only \ backslash.
And also, I tried replace \ with /
Anyone have an idea how I can replace this symbols? I don't understand regex very well.
s.replace(/\/\\/g, "/")Keep in mind that the first and last/are just delimiters that indicate the start and end of the regex grammar.s = s.replace(/\/?\\/g, "/")