library(stringr)string = "248_HIGH_FAN_BLADE"pattern = "\\b[A-Z0-9]+([A-Z0-9]_[A-Z0-9])";str_match_all(string, pattern)[[1]][,2]
Standard input is empty
[1] "8_H"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!