Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: alternation option end of string
On Sun, May 3, 2026 at 6:56 AM Ray Andrews <rayandrews@xxxxxxxxxxx> 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.)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author