I want help with regular expressions to solve the following problem:
I have a string such as \"1£23$456$£$\"
when I split on it I want the output in my strin
Use a look behind, which is non-consuming:
String[] parts = str.split("(?<=\\D)");
That's all there is to it. The regex means to split "just after every non-digit", which seems to be exactly your intention.
Some test code:
String str = "1£23$456$£$";
String[] parts = str.split("(?<=\\D)");
System.out.println( Arrays.toString( parts));
Output:
[1£, 23$, 456$, £, $]