The string I want to split is as given below.
String text = " *Some text* *Another text* *Yet another text* **last text**";
I need to split the above string so that I can get an array like below.
String[] array = {"Some text", "Another text", "Yet another text", "last text"}
If you notice, first three texts have single asterisk(*) around them, while the last one has double asterisk around it.
Also, texts can have spaces in between eg. *Some text*
.
There will be not be any space between text and *
e.g. *Text* - will happen
* some text * - will not happen
Can anyone help as I am not aware of regular expressions that much.