I have a piece of code that splits a string into array of String.Becuase of quotes contains in a string it is unable to split using comma.
The regex is a part of my code so I can't remove the whole regex what I can do is I can expand it
String lines = "70001223,fjdhsd,jahd\",37874,dfhjkd,jadhj";
String columns [] = lines.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1);
for(int i = 0; i < columns.length; i++){
System.out.println(columns[i]);
}
70001223,fjdhsd,**jahd"**
37874
dfhjkd
jadhj
this is the actual result but what I want the actual result is
70001223,
fjdhsd,
**jahd"**
37874
dfhjkd
jadhj
see the difference the quote(") is causing problem.