Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

How to split multiline text into an array?

Topic Labels: Scripting extentions
Solved
Jump to Solution
1172 1
cancel
Showing results for 
Search instead for 
Did you mean: 

I have some multiline text I for some reason do not seem to be able to split into parts.

My text is:
“506070
80”

let arr = multi.toString().split(" ");
console.log(arr) //["506070 80"]

Does anyone know how I can split this?
If i make real space in the multiline text it splits as expected.

1 Solution

Accepted Solutions
Kim_Trager1
9 - Sun
9 - Sun

for anyone need to do the same I figured it out.

let arr = multi.replace(/(\r\n)|\r|\n/g, '\n').split(/\n+/g);

See Solution in Thread

1 Reply 1
Kim_Trager1
9 - Sun
9 - Sun

for anyone need to do the same I figured it out.

let arr = multi.replace(/(\r\n)|\r|\n/g, '\n').split(/\n+/g);