I have data like below
111,222,"33,44,55",666,"77,88","99"
it is delimited by ,
and also placed between quote character to ignore delimiter inside data
String input = "111,222,\"33,44,55\",666,\"77,88\",\"99\"";
String[] splits = input.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
for(String s : splits){
System.out.println(s);
}
Above code is working fine and returns
111
,222
,"33,44,55"
,666
,"77,88"
,"99"
but now the data itself contain quote character
111,222,"33,"44,55",666,"77,88","99"
I want to get back
111
,222
,"33,"44,55"
,666
,77,88
,99
but I get 111,222,"33
,"44,55"
,666
,"77,88"
,"99"
String input = "111,222,\"33,\"44,55\",666,\"77,88\",\"99\"";
the pattern is not working correctly can someone help me to get the data if quote character is part of data