[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] doc: detail inconsistencies in sed word boundary handling

From: Eric Blake
Subject: Re: [PATCH] doc: detail inconsistencies in sed word boundary handling
Date: Tue, 1 Nov 2016 08:46:07 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 10/30/2016 12:01 PM, Pádraig Brady wrote:
> * doc/autoconf.texi (Limitations of usual tools): Display a
> table showing where the various syntaxes for word boundaries
> are supported.
> ---
>  doc/autoconf.texi | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> diff --git a/doc/autoconf.texi b/doc/autoconf.texi
> index 4be1f70..2e4b7ba 100644
> --- a/doc/autoconf.texi
> +++ b/doc/autoconf.texi
> @@ -19666,6 +19666,18 @@ $ @kbd{echo abc | busybox sed '/a\(b\)c/ 
> s/a\(b\)c/\1/'}
>  b
>  @end example
> +Portable scripts should be aware of the inconsistencies and
> +options for handling word boundaries.
> +
> address@hidden
> +                \<      \b      [[:<:]]
> +Solaris 10      yes     no      no
> +Solaris XPG4    yes     no      error
> +NetBSD 5.1      no      no      yes
> +FreeBSD 9.1     no      no      yes
> +GNU             yes     yes     error
> +busybox         yes     yes     error
> address@hidden example

It might be nice to add Cygwin to the list, although I don't know if one
row is sufficient.  It bases its regex engine on BSD code but adds an
extension for \< and \>; but depending on whether a program uses the
libc regex or its own, you can get GNU behavior (that is, Cygwin grep
supports \< and \b but not [[:<:]] because it uses gnulib and bypasses
native regex; while a native application supports [[:<:]] and \< but not
\b because of the BSD heritage plus cygwin extension).

It may be worth pointing out that POSIX does not require ANY support for
word boundaries in regex.


Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]