As discussed in the comments, since you're parsing a CSV file, you're going to want to use a library specifically written to parse CSVs. Otherwise you'll continue to run into problems where what you write is "useless when a different patten comes out" (as you said).
However, to solve the question at hand you just have to split on a comma, ignoring commas inside of quotes. So you can do this (from this answer):
String input = "retinol,\"3,7,11,15-tetramethyl-2,4,6,10,14-hexadecapentaenoic acid\",C034534,81485-25-8,\"Carcinoma, Hepatocellular\",MESH:D006528,Cancer|Digestive system disease,,17270033,therapeutic";
String[] output = input.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
for(String s : output){
System.out.println(s);
}
This will give you this output (note the quotes and empty line):
retinol
"3,7,11,15-tetramethyl-2,4,6,10,14-hexadecapentaenoic acid"
C034534
81485-25-8
"Carcinoma, Hepatocellular"
MESH:D006528
Cancer|Digestive system disease
17270033
therapeutic
You can replace the quotes and ignore the empty line as you wish. This loop will print the exact output requested in the question:
int i=1;
for(String s : output){
if(!s.isEmpty()){
System.out.println(i++ + ". " + s.replace("\"", ""));
}
}
Output:
- retinol
- 3,7,11,15-tetramethyl-2,4,6,10,14-hexadecapentaenoic acid
- C034534
- 81485-25-8
- Carcinoma, Hepatocellular
- MESH:D006528
- Cancer|Digestive system disease
- 17270033
- therapeutic
But, please, use a library like OpenCSV.