Ruphaa's Notes

How to use array split with regex in JS

js
regex

const list = "a a a  b  c c  d d d d  e e e e e";
const words = list.split(/\s{1,}/);

console.log(words);

// ["a", "a", "a", "b", "c", "c", "d", "d", "d", "d", "e", "e", "e", "e", "e"]

Resources

https://www.tracedynamics.com/javascript-split-string-method/