Subject: Re: Repalcement for grep(1)
To: Jamie Howard <howardjp@wam.umd.edu>
From: Archie Cobbs <archie@whistle.com>
List: tech-userlevel
Date: 07/04/1999 18:09:02
Jamie Howard writes:
> Now, I am having a problem though. I cannot figure out how to implement
> -w and -x. For -x, I tried modifying the regular expression (foo) into
> ^(foo)$ before compiling, but that did not work. I intended to do
> something similar with -w. Anyway, I am probably missing the obvious, but
> does anyone have any ideas regarding how I should implement -w and -x?
From the re_format(7) man page:
There are two special cases- of bracket expressions: the
bracket expressions `[[:<:]]' and `[[:>:]]' match the null
string at the beginning and end of a word respectively. A
word is defined as a sequence of word characters which is
neither preceded nor followed by word characters. A word
character is an alnum character (as defined by ctype(3))
or an underscore. This is an extension, compatible with
but not specified by POSIX 1003.2, and should be used with
caution in software intended to be portable to other sys-
tems.
Perhaps this will help with -w?
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com