Reputation: 1162
I want to list all files that start with "aT_" and have the extention ".tif" (e.g aT_123456_1x1_abcdef.tif
):
files<- list.files(pattern="^aT_")
files<- list.files(pattern="\\.tif$")
How can I combine the patterns? Is there a wildcard for any kind of symbol: e.g 0-9,a-z, A-Z, _? Something like files<- list.files(pattern="^aT_[any kind of symbol]\\.tif$")
?
Upvotes: 8
Views: 13369
Reputation: 174696
Use .*
for matching any kind of character except line breaks.
files<- list.files(pattern="^aT_.*\\.tif$")
or
files<- list.files(pattern="^aT_\\w*\\.tif$")
Upvotes: 17