gsub("\\d+(?!.*_)", "", "123_123_abc_123-AB-DC-D4G6", perl = TRUE)
Standard input is empty
[1] "123_123_abc_-AB-DC-DG"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!