Subject: Re: bin/16775: ed documentation is unclear regarding \< and \>
To: None <joda@pdc.kth.se>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 05/12/2002 19:40:39
[ On , May 12, 2002 at 17:17:48 (+0200), Johan Danielsson wrote: ]
> Subject: bin/16775: ed documentation is unclear regarding \< and \>
>
> Either implement \< and \>, or change the documentation:

*BSD re_format(7) talks about a different form of word anchoring
expressions:

       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.

... and regcomp(3) warns:

     The implementation of word-boundary matching is a bit of a kludge, and
     bugs may lurk in combinations of word-boundary matching and anchoring.

Perhaps for compatability's sake though we should implement \< and \>
especially given that GNU Grep implements them, which could be important
should a decision be made to eliminate GNU Grep from NetBSD and replace
it with a simple implementation with a BSD-like license that uses
regcomp(3), such as this one:

	http://www.wam.umd.edu/~howardjp/software/grep/

(note if such a decision is made I have a "fixed" version of the above
in use on my systems, as well as a nearly complete non-GPL'ed fgrep....)

The \< and \> patterns are sure a heck of a lot easier to type (and
remember!), and according to a P1003.2-D11.2:

     (8)  Arbitrary limitations on historical extensions have been
          eliminated.  (Example:  regular expressions have been described
          so that the popular \< ...  \> extension is allowed.)

which of course hints that the *BSD implementation of [[:<:]] is not
only less popular, but unnecessary for standards compliance.

-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>