I am aware of the fact that, this has been asked before in this forum - Split a string by commas but ignore commas within double-quotes using Javascript. But my requirement is slight different which has been asked here. Sorry for confusing you with my question.
I have a string like below -
myString = " "123","ABC", "ABC,DEF", "GHI" "
Here I want to split this string by comma and store it to an array but ignoring the comma within the double quote. Here is what I have tried so far.
myArray.push(myString.replace(/"/g,"").split(","));
But I'm not sure how to ignore the ',' inside the double quote. Could anyone please help ?
This is how my output should look like -
myArray = ["123","ABC", "ABC,DEF", "GHI"]