I have a string that I want to split into an array using commas as separators. I do not want the parts of the string to be between the brackets that were separated, even if they contain commas.
For instance:
"bibendum, morbi, non, quam (nec, dui, luctus), rutrum, nulla"
It should become:
["bibendum", "morbi", "non", "quam (nec, dui, luctus)", "rutrum", "nulla"]
But when I use the basic .split(",") , it returns:
["bibendum", " morbi", " non", " quam (nec", " dui", " luctus)", " rutrum", " nulla"]
I need to return it:
["bibendum", " morbi", " non", " quam (nec, dui, luctus)", " rutrum", " nulla"]
Your help is appreciated.