I have a string that I want to split into an array by using the commas as delimiters. I do not want the portions of the string that is between parentheses to be split thoug
var start = "bibendum, morbi, non, quam (nec, dui, luctus), rutrum, nulla";
start = start.replace(/ /g,'');
console.log(start);
var front = start.substring(0,start.lastIndexOf('(')).split(',');
var middle = '('+start.substring(start.lastIndexOf('(')+1,start.lastIndexOf(')'))+')';
var end = start.substring(start.lastIndexOf(')')+2,start.length).split(',');
console.log(front)
console.log(middle)
console.log(end)
return front.concat(middle,end);