I have this string "u2x4m5x7" and I want replace all the characters but a number followed by an x with "". The output should be: "2x5x" Just the number followed by the x. But I am getting this: "2x45x7"
I'm doing this:
String string = "u2x4m5x7";
String s = string.replaceAll("[^0-9+x]","");
Please help!!!