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-04-29 12:55 UTC ====================================================================== Summary: Add \A and \z to regular expressions (at least EREs) ======================================================================
---------------------------------------------------------------------- (0007161) dwheeler (reporter) - 2025-04-29 12:55 https://www.austingroupbugs.net/view.php?id=1919#c7161 ---------------------------------------------------------------------- No, using only \Z for "end of string" would be a TERRIBLE result. Using \Z would solve NOTHING, because there would *still* not be a standard pair of regex markers that work on most platforms. That's the problem I'm trying to solve: there should be ONE way to indicate this in a regex that works everywhere. The vast majority of existing platforms use \Z as a synonym for \n?\z. That includes Java, .NET/C#, Perl, PCRE, PHP (using PCRE), and Ruby. Some use \z as end-of-string and don't assign a meaning to \Z. This includes RE2 <https://github.com/google/re2/wiki/Syntax> widely used by Go and Rust crate regex widely used by Rust. JavaScript doesn't currently support \A and \z, but they have a stage 2 proposal for them (note that it does NOT use \Z): https://github.com/tc39/proposal-regexp-buffer-boundaries . I know of no proposal for supporting \Z in JavaScript. For more info, see: https://best.openssf.org/Correctly-Using-Regular-Expressions-Rationale Python is the *ONLY* platform I know of that uses \Z for end-of-string, which is incompatible with almost every other platform. I'm the process of drafting a fix to Python to add \z. If the group wants to also add \Z as a synonym for \n?\z that would be fine, that would add yet another anchor that is widely supported, though one that's not nearly as important. The point is to have a *single* expression for beginning & ending of a string that works everywhere. Almost all platforms use \A ... \z, and the other platforms have no *conflict* with those markers, making this pair the only practical option. Thanks! 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 ======================================================================
