Skip to content
Back to formatted view

Raw Message

Message-ID: <42832A77.9090406@lancaster.ac.uk>
Date: 2005-05-12T10:05:43Z
From: Barry Rowlingson
Subject: R2.1.0: Bug in list.files
In-Reply-To: <42831B79.6070308@statistik.uni-dortmund.de>

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