To make it very simple : how can I have two matches here ?
console.log(', , ,'.match(/,\s+,/g));
>Solution :
You want to, instead of matching the comma directly, use a "positive lookahead" to check for a ,
past the right edge of the match.
That way the next group can also match the ,
:
console.log(', , ,'.match(/,\s+(?=,)/g));