Re: alternation option end of string

Bart Schaefer <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAH+w=7bE-DwvBMZkGEic92cn9Rq09bRM0S7JSMd2dwba7k2C-w__40976.1606760853$1777760775$gmane$org@mail.gmail.com>
On Sat, May 2, 2026 at 9:59 AM Ray Andrews <[email protected]> wrote:
>
> ${${(M)string:#cat(|s*)}[1,4]}
>
> But the length of the string is arbitrary I can't use any sort of length.

See my previous message with the ${things:-${thing}} example.

> Too bad what Mark said about using the '$' to test for the end of the string seems not to work

It wouldn't have worked even if you were using a regular expression,
for the same reason that (s|) didn't do what you want.  In the
comparison to the string "catszzz" the $ means the end of THAT string
(that is, after the third "z").  It does NOT mean the "end of
matching" up to that point.
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.