Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
72
rated 0 times [  74] [ 2]  / answers: 1 / hits: 182246  / 12 Years ago, thu, march 22, 2012, 12:00:00

I have this string:



var someString = 23/03/2012;


and want to replace all the / with -.



I tried to do this:



someString.replace(///g, -);


But it seems you cant have a forward slash / in there.


More From » javascript

 Answers
49

You need to escape your slash.



///g

[#86665] Wednesday, March 21, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
noel

Total Points: 49
Total Questions: 90
Total Answers: 104

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
;