Subject: Re: bin/23853: sed's "regular expressions" suck
To: None <email@example.com>
From: Greg A. Woods <firstname.lastname@example.org>
Date: 01/01/2004 22:24:16
[[ NOTE: Your "reply-to" header said: <email@example.com>!
That's not valid in several ways. :-) ]]
[ On Tuesday, December 23, 2003 at 06:59:46 (-0500), firstname.lastname@example.org wrote: ]
> Subject: bin/23853: sed's "regular expressions" suck
> sed's "regular expressions" are downright embarassing.
> There are no alternations "|", no "+", no '?', not much of anything.
What do you expect when the manual page says quite explicitly:
SED REGULAR EXPRESSIONS
The sed regular expressions are basic regular expressions (BRE's, see
regex(3) for more information).
However you'll also find the following useful hint in the manual page:
-E Enables the use of extended regular expressions instead of the
usual basic regular expression syntax.
> The manpage makes a misleading reference to re_format(7).
It's not misleading at all (though the reference to regex(3) that I
happened to quote above should be changed to also be a reference to
re_format(7)). re_format(7) is the right place to find the canonical
description of NetBSD's BREs and EREs.
Note that the Single UNIX Specification Version 3 (i.e. IEEE
P1003.2-2001) only required BREs. The "-E" feature is an extension.
There are notes in the source about other issues with "sed" vs. POSIX,
though they should probably be updated to compare to the release version
of the POSIX documents instead of the old draft they now compare to.
> Incidentally, I found this while trying to port Linux's "killall", from
> their psmisc SRPM.
Someone should tell them that their script is not a POSIX confoming
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <email@example.com>
Planix, Inc. <firstname.lastname@example.org> Secrets of the Weird <email@example.com>