bug-gnu-utils
[Top][All Lists]
Advanced

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

sed documentation bug report


From: Nils Barth
Subject: sed documentation bug report
Date: Thu, 11 Jul 2013 12:48:52 +0900

Dear sed maintainers,
*(CCing Paolo, in case you can forward this to appropriate people.)*

There's a minor omission in the sed documentation, at least as of 4.2.1
(don't have 4.2.2 to check):
it forgets to mention that | also needs to be escaped in basic regular
expressions,
but not in extended regular expressions.

http://www.gnu.org/software/sed/manual/html_node/Extended-regexps.html
http://www.gnu.org/software/sed/manual/sed.html#Extended-regexps
It reads:
"The only difference between basic and extended regular expressions is in
the behavior of a few characters: ‘?’, ‘+’, parentheses, and braces (‘{}’).
While basic regular expressions require these to be escaped if you want
them to behave as special characters, when using extended regular
expressions you must escape them if you want them to match a literal
character."

It should read:
"The only difference between basic and extended regular expressions is in
the behavior of a few characters: ‘?’, ‘+’, ‘|’, parentheses, and braces
(‘{}’). While basic regular expressions require these to be escaped if you
want them to behave as special characters, when using extended regular
expressions you must escape them if you want them to match a literal
character."

...and add the example:
a\|b
becomes ‘a|b’ when using extended regular expressions. It matches ‘a’ or
‘b’.

Compare the grep documentation:
http://www.gnu.org/software/grep/manual/html_node/Basic-vs-Extended.html#Basic-vs-Extended
"In basic regular expressions the meta-characters ‘?’, ‘+’, ‘{’, ‘|’, ‘(’,
and ‘)’ lose their special meaning; instead use the backslashed versions
‘\?’, ‘\+’, ‘\{’, ‘\|’, ‘\(’, and ‘\)’."

Hope this helps, and thanks for the great software!

Best,
Nils Barth


For reference:
:; sed --version
GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <address@hidden>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.


reply via email to

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