Hey, I can\'t figure out how to write a regular expression for my website, I would like to let the user input a list of items (tags) separated by comma or by comma and a spa
Here's a simpler solution:
console.log("test, , test".match(/[^,(?! )]+/g));
It doesn't break on empty properties and strips spaces before and after properties.