I was trying to get matched strings using Grepl.
Code
dt_test <- data.frame(
a = c("ab","abcd", "poo", "abla", "ba"),
id = c(1,2,3, 4,5)
)
grepl('^ab|^ao', dt_test$a)
What it returns was TRUE TRUE FALSE TRUE FALSE But I want ro print Matched strings like "ab","abcd", "abla"