Hey, i have a little problem with my regex function.
Suppose i have the following string: 2+3-4+5
What i want to do is split all the positive numbers. So the result should be:Code:Pattern p = Pattern.compile(""); // Split input with the pattern String[] result = p.split("2+3-4+5"); for (int i=0; i<result.length; i++) System.out.println(result[i]);
2
3
5
What i get with my regexp. is:
2
3-4
5
I dont want it to take the -4 with it. How can i solve this...




Reply With Quote