You can try breaking up the regular expression, for example (?<=\D)(?=\d) . Try the following:
String str = "abcd1234"; String[] part = str.split("(?<=\\D)(?=\\d)"); System.out.println(part[0]); System.out.println(part[1]);
displays
abcd 1234
You can Integer.parseInt(part[1]) String digit on Integer using Integer.parseInt(part[1]) .
source share