Regular expression

You must Login before you can answer or comment on any questions.

Hi I need to remove all the spaces and new line command(\n) from the web content. How can i remove it using the regular expression

3 Answers

Try this:

var s = "test 123\nline 2\n\nline 4";
s.replace(/\s/g, '');

Your Answer

Think you can help? Login to answer this question!