Option 1
You can match a against all terms in b with sapply
sapply(b, grepl, a)
sky day
[1,] TRUE FALSE
[2,] FALSE FALSE
[3,] FALSE TRUE
Then you collapse all rows with apply
and subset a
.
a[apply(sapply(b, grepl, a), 1, any)]
[1] "Look at the sky" "cloudy day"
Option 2
Create a combined regexp pattern
paste(b, collapse="|")
[1] "sky|day"
and grep with it
a[grepl(paste(b, collapse="|"), a)]
[1] "Look at the sky" "cloudy day"