1

Tue,Sep,21,15:48:1,CEST,2010

I would replace the "," with a space.

I have tried:

string=string.replace("/,/g"," ");

and the result is:

Tue,Sep,21,15:48:1,CEST,2010

I have tried:

string=string.replace(","," ");

and the result is:

Tue Sep,21,15:48:1,CEST,2010

How can I replace all the "," with " "?

Thanks.

2 Answers 2

4

Remove the quotes around your regular expression and it will work:

string=string.replace(/,/g," ");
Sign up to request clarification or add additional context in comments.

Comments

2

"/,/g" is a string, not a regular expression

/,/g is a regular expression.

string=string.replace(/,/g," ");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.