I found that split regex in java is working as greedy
String str = ";;;";
System.out.println(str.split(";").length);
output - 0 (wrong)
expected - 4
String str = ";;;a";
System.out.println(str.split(";").length);
output - 4
I tried to modified the regex and make it lazy using regex as ;+? but got output as 0.
Any idea how to make regex as greedy for split here will be much appreciated.
Thanks in advance