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

Re: Remove multiple characters after match



On Mon, Dec 18, 2023 at 11:34 PM Jörg Sommer <joerg@xxxxxxxx> wrote:
>
> How can I remove the spaces after the left delimiter?

You're trying to get the shortest match for (*) and the longest match
for ( #), which doesn't work.  I think your best bet is to first
remove all the spaces around delimiters:

${(*)x// #,, #/,,}

And then leave space matching out of the # and % constructions:

% print -l -- -${(*)^${(*)${(*)x// #,, #/,,}#*,,}%,,*}-
-*.i-
-*.i-
-*.i-
-*.i-
-*.i-
-*.i-

You didn't actually say what output you wanted but I think that's it?




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