Re: alternation option end of string
Bart Schaefer <[email protected]> Sun, 3 May 2026 11:45:52 -0700
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAH+w=7YUweTqE98b2pKn30Kmgut2zXxNUTS6h0n7Kt8Wb67xmA@mail.gmail.com> |
On Sun, May 3, 2026 at 6:56=E2=80=AFAM Ray Andrews <[email protected]>= wrote: > > It might not actually be the '$' just some mechanism for matching a > string that must end after some substring. That's not what you're asking for, tho. You're asking for the entire string to fail to match if there's anything after the substring, but in the same pattern you want the substring itself to match so you can extract it. You can't simultaneously have a failure and a success. That's why Roman's solution has (compare && out=3Dsuccess || out=3Dfailure) -- there's no single pattern expression that can do both branches. (There might be a perl expression that works, but I'm not confident pcre is perl-ish enough to do it.)