I have a string like below:
{{"textA","textB","textC"}}
And currently, I'm using below code to split them:
string stringIWantToSplit = "{{\"textA\",\"textB\",\"textC\"}}";
string[] result = stringIWantToSplit.Split(',');
And I can get the below result:
{{"textA"
"textB"
"textC"}}
After that, I can manually trim out the '{' and '}' to get the final result, but here is the problem:
If the string is like below:
`{{"textA","textB,textD","textC"}}`
Then the result will be different from Expected result
Expected result:
"textA"
"textB,textD"
"textC"
Actual result:
{{"textA"
"textB
textD"
"textC"}}
How can I get the string between two double quotes?
Updated:
Just now when I checked the data, I found that some of them contains decimals i.e.
{{"textA","textB","",0,9.384,"textC"}}
Currently, I'm trying to use Jenish Rabadiya's approach, and the regex I'm using is
(["'])(?:(?=(\\?))\2.)*?\1
but with this regex, the numbers aren't selected, how to modify it so that the numbers / decimal can be selected?