S <- "abcd2efghi2.txt"
sub("\\d+(\\D*)$", "\\1", S)