df %>% filter(grepl(".cpp|.h", File_name)) File_name Folder 1 ord.cpp 1 2 ppol.h 2 3 lko.cpp 3 4 t_po..lo.cpp 4