|Summary:||base::glob2rx does not recognise escaped wildcards|
|Product:||R||Reporter:||Adam Obeng <bugs.r-project.org>|
Description Adam Obeng 2016-05-04 10:03:29 UTC
Unix glob allows the wildcards to be escaped with a backslash, but glob2rx doesn't. This matters for filenames which contain a literal '*', '?', or other glob wildcard. Assuming a directory structure like: testdir ├── *.txt └── anything.txt > system('ls testdir/\\*.txt') testdir/*.txt > Sys.glob('testdir/\\*.txt')  "testdir/*.txt" > list.files(path='testdir', glob2rx('\\*.txt')) character(0) As expected, glob2rx incorrectly treats this '*' as a wildcard: > glob2rx('\\*.txt')  "^\\.*\\.txt$" Although the docs note that glob2rx may not work with arbitrary characters in the pattern, this kind incompatibility might still be unexpected. For example, a naive use of glob2rx on filepaths would allow wildcards to match '/', which glob does not.