my_names <- c('a\nb\nc') library(stringr) str_extract(my_names, 'a(.|\r\n?|\n)*b.*')
Standard input is empty
[1] "a\nb"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!