Linux.com

first example is misleading

Posted by: Anonymous Coward on August 04, 2005 05:49 AM
This example is misleading:

> grep expression *.html<nobr> <wbr></nobr>...
> This is the simplest form of regular expression

When I first read this, I thought the author was calling '*.html' a regular expression. Instead, he meant that "expression" is a regular expression -- one with no metacharacters.

If I remember correctly, '*.html' is called a glob. (Read the bash man page.)

If ' *.html' were treated as a regular expression, you'd be searching for files with
zero or more spaces ( *) followed by any character (.) followed by html (html). Obviously this is absurd for this example.

The author might be more careful about his examples. Using:

    grep expression myfile.txt
would have been much clearer.

-drane

#

Return to CLI Magic: Regular expressions and metacharacters