Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: alternation option end of string



On Sat, May 2, 2026 at 9:59 AM Ray Andrews <rayandrews@xxxxxxxxxxx> 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.




Messages sorted by: Reverse Date, Date, Thread, Author