x <- c("The cats are eating catfood",
"Our cat is eating the catfood",
"the dog eats catfood, he likes it",
NA)
txt_contains(x, patterns = c("cat", "dog"))
txt_contains(x, patterns = c("cat", "dog"), value = TRUE)
txt_contains(x, patterns = c("eats"), value = TRUE)
txt_contains(x, patterns = c("^The"), ignore.case = FALSE, value = TRUE)
txt_contains(x, patterns = list(include = c("cat"), exclude = c("dog")),
value = TRUE)
txt_contains(x, "cat") & txt_contains(x, "dog")
Run the code above in your browser using DataLab