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

Re: Filtering array on index



On Fri, Oct 26, 2018 at 1:22 AM dana <dana@xxxxxxx> wrote:
>
> If so, i guess this might qualify as 'compact':
>
>   ${filters:#${~:-(${(j<|>)${(b)overrides/#-f/-v}})}}

It's not even as difficult as that if you don't need to keep the "-v" prefixes:

% print -lr -- ${${filters#-v}:#${(j:|:b)~overrides#-f}}
two

If there are no filters that are a proper suffix of another filter,
you can do this to preserve the "-v" prefix:

% print -lr -- ${${filters}%${(j:|:b)~overrides#-f}}

> Add (M) to the outer expansion if you want it the other way around

Same above.



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