Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Remove multiple characters after match
- X-seq: zsh-users 29382
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Jörg Sommer <joerg@xxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: Remove multiple characters after match
- Date: Wed, 20 Dec 2023 14:28:35 -0800
- Archived-at: <https://zsh.org/users/29382>
- In-reply-to: <molzf7qu3w4q5bf7gdybj3fmp5p2sursypac3mjogtc6sqnjvu@a2jp2ge72tzl>
- List-id: <zsh-users.zsh.org>
- References: <molzf7qu3w4q5bf7gdybj3fmp5p2sursypac3mjogtc6sqnjvu@a2jp2ge72tzl>
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