The following issue has been SUBMITTED. ====================================================================== https://austingroupbugs.net/view.php?id=1757 ====================================================================== Reported By: larryv Assigned To: ====================================================================== Project: Issue 8 drafts Issue ID: 1757 Category: Shell and Utilities Type: Error Severity: Editorial Priority: normal Status: New Name: Lawrence Velázquez Organization: User Reference: Section: expr Page Number: 2895 Line Number: 96621 Final Accepted Text: ====================================================================== Date Submitted: 2023-07-15 01:59 UTC Last Modified: 2023-07-15 01:59 UTC ====================================================================== Summary: expr: incorrectly describes BRE subexpression as "[\(...\)]" Description: The behavior of the <i>expr</i> ':' operator when its pattern operand contains a BRE subexpression is described on page 2895, lines 96620-96623:<blockquote>Alternatively, if the pattern contains at least one regular expression subexpression "[\(...\)]", the string matched by the back-reference expression "\1" shall be returned. If the back-reference expression "\1" does not match, then the null string shell be returned.</blockquote>This implies that subexpressions include or must be enclosed between '[' and ']'. However, as per XBD Section 9.3.5, '[' introduces a bracket expression, within which a subexpression cannot occur (since "\(" is not treated specially).
This is the corresponding text from Commands and Utilities, Issue 5, page 337:<blockquote>Alternatively, if the pattern contains at least one regular expression subexpression [\(...\)], the string corresponding to \1 will be returned.</blockquote>It seems clear that '[' and ']' were being used in a parenthetical, not literal, capacity, but Issue 6 (https://pubs.opengroup.org/onlinepubs/009695399/utilities/expr.html) missed that and simply wrapped the whole thing in quotation marks. It's been wrong ever since. Desired Action: Change:<blockquote>"[\(...\)]"</blockquote>to:<blockquote>"\(...\)"</blockquote> ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2023-07-15 01:59 larryv New Issue 2023-07-15 01:59 larryv Name => Lawrence Velázquez 2023-07-15 01:59 larryv Section => expr 2023-07-15 01:59 larryv Page Number => 2895 2023-07-15 01:59 larryv Line Number => 96621 ======================================================================