Pattern pattern = Pattern.compile("([^\\d.]|[\\d.]++)");
String[] equation = pattern.split("5+3--323");
System.out.println(equation.length);
I’m trying to break apart numbers (could be groups) and nonnumbers, in this example i was hoping for a size 6 array:
5, +, 3, -, -, 323
how can I do this?
Try using matcher, as in example below. It returns exactly what you are after.