On 2023-03-19 02:27, David Kra wrote:
TOBE: "Although the syntaxes differ, in GNU grep there is no difference in
available functionality between basic and extended syntaxes."
I'm not a fan of "syntaxes". Although it is a word in computer science
it grates in my ear because in linguistics "syntax" is a field of study
and there is only one syntax just as there is only one rhetoric and
there is only one logic.
Anyway (to get off my soapbox :-) there's a bigger problem in the next
sentence, which says, "In other implementations, basic regular
expressions are less powerful." That's not true for POSIX BREs, as they
have back-references, which POSIX EREs lack. (This is documented in the
GNU grep manual's "Problematic Expressions" section.) And I doubt
whether it's true that PCRE2 is a strict superset of EREs so we should
scale the wording back a bit there too.
I installed the attached doc patch, which I hope fixes these problems.
(It also fixes a couple of troff typos I noticed in the neighborhood.)From 15f1f50e20e7bf615f338a6e064955fff9e4ab67 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Mon, 20 Mar 2023 00:20:05 -0700
Subject: [PATCH] doc: clarify BRE vs ERE (bug#62272)
---
doc/grep.in.1 | 15 ++++++++-------
doc/grep.texi | 9 +++++----
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/doc/grep.in.1 b/doc/grep.in.1
index edc4bc7..f7b8a03 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -715,12 +715,12 @@ This can cause a performance penalty.
.BR \-U ", " \-\^\-binary
Treat the file(s) as binary.
By default, under MS-DOS and MS-Windows,
-.BR grep
+.B grep
guesses whether a file is text or binary as described for the
.B \-\^\-binary\-files
option.
If
-.BR grep
+.B grep
decides the file is a text file, it strips the CR characters from the
original file contents (to make regular expressions with
.B ^
@@ -756,13 +756,14 @@ expressions, by using various operators to combine smaller expressions.
understands three different versions of regular expression syntax:
\*(lqbasic\*(rq (BRE), \*(lqextended\*(rq (ERE) and \*(lqperl\*(rq (PCRE).
In GNU
-.B grep
-there is no difference in available functionality between basic and
-extended syntax.
-In other implementations, basic regular expressions are less powerful.
+.BR grep ,
+basic and extended regular expressions are merely different notations
+for the same pattern-matching functionality.
+In other implementations, basic regular expressions are ordinarily
+less powerful than extended, though occasionally it is the other way around.
The following description applies to extended regular expressions;
differences for basic regular expressions are summarized afterwards.
-Perl-compatible regular expressions give additional functionality, and are
+Perl-compatible regular expressions have different functionality, and are
documented in
.BR pcre2syntax (3)
and
diff --git a/doc/grep.texi b/doc/grep.texi
index 7a00add..4ed9782 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -1190,12 +1190,13 @@ by using various operators to combine smaller expressions.
three different versions of regular expression syntax:
basic (BRE), extended (ERE), and Perl-compatible (PCRE).
In GNU @command{grep},
-there is no difference in available functionality between basic and
-extended syntax.
-In other implementations, basic regular expressions are less powerful.
+basic and extended regular expressions are merely different notations
+for the same pattern-matching functionality.
+In other implementations, basic regular expressions are ordinarily
+less powerful than extended, though occasionally it is the other way around.
The following description applies to extended regular expressions;
differences for basic regular expressions are summarized afterwards.
-Perl-compatible regular expressions give additional functionality, and
+Perl-compatible regular expressions have different functionality, and
are documented in the @i{pcre2syntax}(3) and @i{pcre2pattern}(3) manual
pages, but work only if PCRE is available in the system.
--
2.37.2