I need to split my text into pieces and also keep the delimiter as well, I know I can use below code to do that as explained Here:
Arrays.toString("a;b;c;d".split("((?<=;)|(?=;))"))
but what I'm stuck is that my text contains delimiter with a value inside it, my delimiter is @[x]@ where x is a value which can be any number. eg: @[1]@, @[44]@. What I want to achieve is to get an array as below:
text : "Hello my Name is blabla.@[1]@How are you today?@[2]@ByeBye"
and what I need to get:
[ "Hello my Name is blabla.", "@[1]@", "How are you today?", "@[2]@", "ByeBye" ]
How can I achieve that? Thanks in advance.