I need a last alphabetic character of string example: ABRACADABRA123456
. The regex expression [a-zA-Z](?=\d+)
give me the match in all my cases. How can I change (inverse) the expression to use it in java method e.g.: "ABRACADABRA123456".replaceAll(<inverse-regex>,"")
?
INPUT:ABRACADABRA123456
USE:"ABRACADABRA123456".replaceAll(...)
OUTPUT:A
(a last alphabetic character of string)
RESOLVED:System.out.println("ABRACADABRA123456".replaceAll("([\\D]+)([a-zA-Z](?=\\d+))([\\d]+)","$2")));