Re: [R] R2.1.0: Bug in list.files

From: Barry Rowlingson <>
Date: Thu 12 May 2005 - 20:05:43 EST

Uwe Ligges wrote:

> Please read about regular expressions (!!!) and try to understand that
> ".txt" also finds "Not_a_txt_file.xls" ....

  The confusion here is between regular expressions and wildcard expansion known as 'globbing'. The two things are very different, and use characters such as '*' '.' and '?' in different ways.

  There's added confusion when people come from a DOS background, where commands did their own thing when given '*' as parameter. The DOS command:

  RENAME *.FOO *.BAR   did what seems obvious, renaming all the .FOO files to .BAR, but on a unix machine doing this with 'mv' can be destructive!

  In short (and slightly simplified), a '*' when expanded as a wildcard in a glob matches any string, whereas a '*' in a regular expression (regexp), matches the previous character 0 or more times. This is why "*.zip" is flagged as invalid now - there's no character before the "*".

  That should be enough clues to send you on your way.

  Baz mailing list PLEASE do read the posting guide! Received on Thu May 12 20:38:28 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:44 EST