On Sat, Apr 26, 2025 at 10:54:19AM -0700, Paul Eggert wrote: > On 2025-04-24 09:13, Eric Blake wrote: > > > case '\'': > > + case 'z': > > Python uses \Z for this and Python's \A ... \Z is cleaner and easier to > remember than Perl's \A ... \z, so how about if we follow Python's lead > instead? Users could get the effect of Perl's \Z, which is less commonly > wanted, with Python's \n?\Z or with current glibc's "\n?\\'".
As pointed out in the POSIX thread, \Z is not portable (in Perl, it maps to glibc \n?\', in Python it maps to glibc \'); if POSIX tries to standardize \Z to either meaning, the other language will not match POSIX (and changing to match POSIX would be non-backwards-compatible). \z on the other hand IS portable in the sense that it either matches glibc \', or is (currently) undefined and thus easy to define as an alias (so languages that have \Z or \' and add an alias with very little new code). If POSIX were to try to standardize \` and \' instead of \A and \z, it would have the benefit of existing practice (glibc), but the drawback of less familiarity (lots more languages would have to adapt, whereas now \A is fairly common and \` is rare). -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org