How do I split a string with multiple separators in JavaScript?
https://stackoverflow.com/questions/650022/how-do-i-split-a-string-with-multiple-separators-in-javascript
WEBMar 16, 2009 · You can pass a regex into JavaScript's split() method. For example: "1,2 3".split(/,| /) ["1", "2", "3"] Or, if you want to allow multiple separators together to act as one only: "1, 2, , 3".split(/(?:,| )+/) ["1", "2", "3"] You have to use the non-capturing (?:) parenthesis, because otherwise it gets spliced back into the result. Or you can be ...
DA: 3 PA: 37 MOZ Rank: 73