Bug 528 proposes adding support for sed -E for sed to use EREs
instead of BREs for addresses and the s command.

The text for the "s" command would probably  need to be updated
as well. At the moment, it says:

> The characters "\n", where n is a digit, shall be replaced by
> the text matched by the corresponding back-reference
> expression. If the corresponding back-reference expression
> does not match, then the characters "\n" shall be replaced by
> the empty string.

However EREs have no "back-references" which is a BRE-only
feature.

Even for BREs, the term "back-reference" doesn't make much sense
in this context. As stated it would imply that in

s/\(foo\)\1/\1/

the right-hand \1 is replaced by what is matched by the
left-hand \1. But not in:

s/\(foo\)/\1/

where the pattern has no "back-reference" just a "subexpression"
or "\(\) enclosed expression" or "parenthesized subexpression"
or "capture group" as often used terminology for those.

Maybe it should be something like: "by the text matched by the
nth \(\)-enclosed (()-enclosed with -E) subexpression in the
pattern (subexpressions being numbered based on the position of
the opening "\(" or "(")"

(or just use "parenthesized subexpression" as in the regexec()
specification).

-- 
Stephane

Reply via email to