I have a string:
"This is the\nstring with\nline breaks\n"
I need to get:
[This, is, the\n, string, with\n, line, breaks\n]
When I use .split(/\s{1,}/) – \n line breaks disappear. How to preserve them?
Multiple spaces need to be considered
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps a
matchwill give you what you want[^\s]+means as many non-space as possible (one or more),\n*means as many new lines as possible (0 or more),|means OR,\n+means as many new lines as possible (one or more).