str_vec <- c("TAG a", "TAG b-3", "TAG c+2", "2+TAG d")stringr::str_extract(str_vec, "TAG [^+-]*")
Standard input is empty
[1] "TAG a" "TAG b" "TAG c" "TAG d"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!