I have a string with value - String sData = "abc|def|\"de|er\"|123";
and I will need to split it with delimiter - "|". In this case, my expected result will be
abc
def
"de|er"
123
Below is my code
String sData = "abc|def|\"de|er\"|123";
String[] aSplit = sData.split(sDelimiter);
for(String s : aSplit) {
System.out.println(s);
}
But it actually comes out the below result
abc
def
"de
er"
123
I have tried with this pattern - String sData = "abc|def|\"de\\|er\"|123";
but it's still not returning my expected result.
Any idea how can I achieve my expected result?