GNU bug report logs -
#28857
Wrong examples in documentation?
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]
This bug report was last modified 6 years and 279 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.