String TextValue = "hello{MyVar} Discover {MyVar2} {MyVar3}";
String[] splitString = TextValue.split("\\{*\\}");
What I'm getting output is [{MyVar, {MyVar2, {MyVar3]
in splitString
But my requirement is to preserve those delimiters {}
i.e. [{MyVar}, {MyVar2}, {MyVar3}]
.
Required a way to match above output.