The first round of this was answered here last night. The solution that @Reimeus gave was great and gives the below output from:
My name is the mighty llama
To:
String[] stringArray = string.split("(?
My name
is the
mighty llama
However, I now find myself need to correct what I'm doing. I actually need to be able to split the string like so.
My name
name is
is the
the mighty
mighty llama
解决方案
you cannot duplicate a token with String.split(), because regex is used to SEARCH.
you cannot do this without some kind of edit, maybe a String.replaceAll() will accomplish.