A NOTE has been added to this issue. ====================================================================== https://www.austingroupbugs.net/view.php?id=1919 ====================================================================== Reported By: dwheeler Assigned To: ajosey ====================================================================== Project: 1003.1(2024)/Issue8 Issue ID: 1919 Category: Base Definitions and Headers Tags: tc1-2024 Type: Clarification Requested Severity: Editorial Priority: normal Status: Resolved Name: David A. Wheeler Organization: User Reference: Section: 9. Regular Expressions Page Number: 1 Line Number: 1 Interp Status: --- Final Accepted Text: see https://www.austingroupbugs.net/view.php?id=1919#c7154 Resolution: Accepted As Marked Fixed in Version: ====================================================================== Date Submitted: 2025-04-19 21:01 UTC Last Modified: 2025-05-05 20:47 UTC ====================================================================== Summary: Add \A and \z to regular expressions (at least EREs) ======================================================================
---------------------------------------------------------------------- (0007181) stephane (reporter) - 2025-05-05 20:47 https://www.austingroupbugs.net/view.php?id=1919#c7181 ---------------------------------------------------------------------- sed's regexps are matched against the pattern space which is initialised from the contents of the current line without the line delimiter but can be modified at will by the sed script including by adding newline characters including by pulling additional lines from the input with the N command. awk's regexps can be applied on anything, grep works on line (the "subject" is the line currently being considered, again not including the line delimiter), ex/vi's AFAICT are meant to be on lines (when not in vi-compatibility mode, vim regexs can have matches spanning several lines and \A there is for "non-alphabetic character", and \z a prefix for several additional regex operators; so in any case those \A, \z cannot be added to vim regexps). In any case, none of them use REG_NEWLINE, so in all POSIX utilities, \A is equivalent to ^ and \z to $ and match at the beginning and end of the subject, not at the beginning/end of each line within the subject. <pre> $ printf 'a\nb\n' | sed 'N; s/^b/X/; s/^a.b$/<&>/' <a b> </pre> ^b did not match because the pattern space never started with b; after N, it starts with a and ended in b with one character (newline) in the middle. \A and \z would only become relevant/useful there if POSIX added support for perl's (?m-s) operators (more or less the equivalent of REG_NEWLINE). Issue History Date Modified Username Field Change ====================================================================== 2025-04-19 21:01 dwheeler New Issue 2025-04-19 21:01 dwheeler Status New => Under Review 2025-04-19 21:01 dwheeler Assigned To => ajosey 2025-04-24 16:20 eblake Note Added: 0007153 2025-04-24 16:26 nick Note Added: 0007154 2025-04-24 16:28 nick Status Under Review => Resolved 2025-04-24 16:28 nick Resolution Open => Accepted As Marked 2025-04-24 16:28 nick Category Front Matter => Base Definitions and Headers 2025-04-24 16:28 nick Interp Status => --- 2025-04-24 16:28 nick Final Accepted Text => see https://www.austingroupbugs.net/view.php?id=1919#c7154 2025-04-24 16:28 nick Tag Attached: tc1-2024 2025-04-24 16:29 geoffclare Project 1003.1(2008)/Issue 7 => 1003.1(2024)/Issue8 2025-04-28 18:55 dwheeler Note Added: 0007157 2025-04-28 21:16 eblake Note Added: 0007159 2025-04-29 12:55 dwheeler Note Added: 0007161 2025-04-29 14:05 dwheeler Note Added: 0007162 2025-05-02 15:42 msbrown Note Added: 0007170 2025-05-05 14:32 dwheeler Note Added: 0007174 2025-05-05 14:48 lanodan Note Added: 0007175 2025-05-05 15:05 lanodan Note Edited: 0007175 2025-05-05 17:45 dwheeler Note Added: 0007179 2025-05-05 18:16 lanodan Note Added: 0007180 2025-05-05 20:47 stephane Note Added: 0007181 ======================================================================
