I have String s = "#stack###over##flow".
How do I split s
to have
String[] a = {"#", "stack", "###", "over", "##", "flow}
I tried s.split("(?<=#)|(?=#)")
as in How to split a string, but also keep the delimiters? but it gives
String[] a = {"#", "stack", "#", "#", "#", "over", "#", "#", "flow}