Hi you are asking
a) how to reprex
FAQ: How to do a minimal reproducible example ( reprex ) for beginners
b) how to filter on strings
library(tidyverse)
(mtcars_df <- as_tibble(mtcars, rownames = "carname"))
patterns <- "Mazda|Merc"
(mtcars_df %>% filter(
str_detect(
carname,
patterns
)))