s <- "1-343-43Hello_2_323.14_fdh-99H"sub("^([^_]*_[^_]*).*", "\\1", s)
Standard input is empty
[1] "1-343-43Hello_2"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!