advertisement

Article:
  Unix for the Rest of Us
Subject:   File Globbing isn't RegEx - Clarification!
Date:   2001-06-21 14:05:46
From:   peterf@mac.com
A note from an astute reader points out that although the * is used in both "file globbing" and regular expressions, the syntax used for each is actually quite different.



David Thompson writes:


----------------------
Hi Peter,


You are incorrect in your recent Mac article where you
compared shell globbing and regular expressions. You
seemed to imply that globbing was a subset of regular
expression patterns, and this is not true at all.


For example, consider how the asterisk is used in
globbing: it is a wild card for zero or more
characters at the current position. In regular
expressions, an asterisk has an entirely different
meaning: zero or more occurences of the previous
character at the current position.


(Actually, in regular expressions, the asterisk means
zero or more occurences of the previous regular expression, so that [abc]* means any combination of the 3 letters a,b, and c.)


-----------------


Of course, this is perfectly true. My intended meaning was that the building of symbolic expressions is deep and wide!


Thanks!


Peter