I'm trying to use the JS split()
function to split on commas that are followed by non-whitespace, while ignoring commas with any whitespace after.
For example, the string "one, two, three", should not be split at all, while "one,two, three" should be split into:
- one
- two, three
I've tried using .split(',\\S')
.split(',(?=\\S)")')
and other variations, but haven't had any luck with getting it to split the way I want.
Use it with regex
or parse the regex string to convert
I got it working with this.
Replace pipe with whatever works for you.