I have to split an input comma separated string and store the result in an array.
Following works great
arr=inputString.split(",")
for this example
John, Doe =>arr[0]="John" arr[1]="Doe"
But it fail to get following expected output
"John, Doe", Dan =>arr[0]="John, Doe" arr[1]="Dan"
John, "Doe, Dan" =>arr[0]="John" arr[1]="Doe, Dan"
Following regex too didn't help
var regExpPatternForDoubleQuotes="\"([^\"]*)\"";
arr=inputString.match(regExpPatternForDoubleQuotes);
console.log("txt=>"+arr)
The String could contain more than two double-quotes.
I am trying above in JavaScript.