Ok, I give up and ask a question after I read the regular expression help article and still don't know what I'm looking for:
I have a list of files:
files <-c("files_combined.csv","file_1-10.csv","file_11-20.csv",
"file_21-30.csv","file_2731-2740.csv","file_2731-2740.txt")
I only need csv files starting with "file_" and ending with ".csv". I know it looks something like this:
grep(pattern = "^file_???.csv$" ,files)
But I need to find the correct regular expression that ignores the number of characters between the first and second patterns ("file_" + ".csv"). I would really appreciate it if someone knows the complete list with regular expressions in R, since it is tedious to read through help every time and, as in my case, it fails, sometimes ...
source
share