Actually i was looking for if there is multiple pattern matching with grepl()
, sub()
and so on say something like grepl(...multiple=TRUE)
. I have a list of files and want to check if multiple extension are existing in the files. For a single extension i use grepl("*.cel$",lst)
where lst
is list of files. It returns TRUE or FALSE.
I have a list of "1.txt" "2.txt" "3.txt" "4.txt" "final.csv""final1.csv" "final2.csv" "GSM248238.CEL" "GSM248650.CEL" "GSM248651.CEL" "GSM248652.CEL" "GSM248653.CEL" "GSM248655.CEL" "GSM248659.CEL" "GSM248660.CEL" "GSM248661.CEL"
Now if i am interested to check something like c(".cel",".txt",".csv")
. I thought to try grepl(c("*.cel$",".txt$",".csv$"), ignore.case=TRUE)
, it gives the extension of first(.cel). Other extension are also present, how to get all the extensions.