Re: alternation option end of string
Bart Schaefer <[email protected]> Sat, 2 May 2026 15:25:01 -0700
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAH+w=7bE-DwvBMZkGEic92cn9Rq09bRM0S7JSMd2dwba7k2C-w@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.