I have a issue, I'm using JS. Let's say I have this text separated by paragraphs:
Test hello
Test1 hello
Test2 hello
Test3 hello
and then I want to join all the paragraphs next to each other like this: Test hello Test1 hello Test2 hello Test3 hello, so I did this:
<pre>
var x = string.trim();
var xArr = x.match(/^\n|\S+/gm);
var xJoin = xArr.join(" ");
</pre>
but it continue as before with paragraphs, I try with string.replace() too. After the x.match(/^\n|\S+/gm) it brings me the array like this:
<pre>
[, ,
Test, hello
, ,
Test1, hello
, ,
Test2, hello
, ,
Test3, hello
, ,
]
</pre>
So this seemed a bit strange to me, could it be that it is not really separated by line breaks? Any idea how to put the strings next to each other? Thanks.