Subject: bug#28857: Wrong examples in documentation?

From: Andreas Öhrén <[email-masked]>
Date: Mon, 16 Oct 2017 01:47:53 +0200

Hello,

I don't have any experience using sed, but it looks to me as though the
documentation doesn't always use the regular expression extension that is
described, in its corresponding example. Here's an excerpt where \B and \S
aren't being used in their examples:

'\b'
     Matches a word boundary; that is it matches if the character to the
     left is a "word" character and the character to the right is a
     "non-word" character, or vice-versa.

          $ echo "abc %-= def." | sed 's/\b/X/g'
          XabcX %-= XdefX.

'\B'
     Matches everywhere but on a word boundary; that is it matches if
     the character to the left and the character to the right are either
     both "word" characters or both "non-word" characters.

          $ echo "abc %-= def." | sed 's/\w/X/g'
          aXbXc X%X-X=X dXeXf.X

'\s'
     Matches whitespace characters (spaces and tabs).  Newlines embedded
     in the pattern/hold spaces will also match:

          $ echo "abc %-= def." | sed 's/\s/X/g'
          abcX%-=Xdef.

'\S'
     Matches non-whitespace characters.

          $ echo "abc %-= def." | sed 's/\w/X/g'
          XXX XXX XXXX

'\<'
     Matches the beginning of a word.

          $ echo "abc %-= def." | sed 's/\</X/g'
          Xabc %-= Xdef.

Version:
sed (GNU sed) 4.4

The documentation states "This file documents version 4.4 of GNU 'sed'".

- Andreas