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

Re: zip arrays exclude empty elements



On Fri, Sep 4, 2020 at 3:03 PM sergio <sergio@xxxxxxxxxxxxx> wrote:
>
> I have an input string in form of 'A[-][B]' that I'd like to translate

I'm not sure if you consider the following to be simpler, but it
doesn't rely on exactly two letters in the split string:

setopt extendedglob
print -r -- ${=${(@s.-.)crop}/(#b)(?)/-${(L)match[1]} ${match[1]}}

Remove the "=" if you want e.g. "-a A" instead of "-a" and "A" as
separate words.




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