On Wed, 16 Oct 1996 12:01:09 -0400 (EDT),
Brock Rozen <brozen(_at_)webdreams(_dot_)com> wrote:
What's the difference between using .* and * ??
FAQ
man egrep
(end of griping) --------------> X
* $ ! ^TOowner-.*$PGHOST
<...>
* $ ! ^TOowner-*$PGHOST
* is the "closure operator", it means "the previous expression zero or
more times".
If you remember that "." is regexp syntax for "any character", you
see that your first example would match any of the following (ignoring
for this discussion the trailing $PGHOST):
owner-foobar
owner-motorcycle
owner-.* (literally :-)
owner-
(etc)
whereas your second example would match the following:
owner
owner-
owner--
owner---
(etc)
To complete the picture, you may want to do a closure on a longer
string. Use parentheses for that:
owner(-something)*
will match
owner
owner-something
owner-something-something
(etc)
Hope this helps; read the manual,
/* era */
--
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
at the following URL: <http://www.ling.helsinki.fi/~reriksso/spam.html>