How do I remove white spaces in a string but not new line character in JavaScript. I found a solution for C# , by using \t
, but it's not supported in JavaScript.
To make it more clear, here's an example:
var s = "this\n is a\n te st"
using regexp method I expect it to return
"this\nisa\ntest"