Re: alternation option end of string

Bart Schaefer <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAH+w=7YUweTqE98b2pKn30Kmgut2zXxNUTS6h0n7Kt8Wb67xmA__5968.66792054556$1777834016$gmane$org@mail.gmail.com>
On Sun, May 3, 2026 at 6:56 AM 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=success ||
out=failure) -- 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.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.