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

Re: Substitute the last match of a pattern during parameters expansion.



On Mon, Sep 12, 2022, 08:01,
Lawrence Velázquez,
<larryv@xxxxxxx>, wrote:

On Mon, Sep 12, 2022, 12:20,
Michele Venturi,

> Hello, I have a problem, can you help me?
> I would like to substitute the last match of
> a pattern during the parameters expansion:
>
> the string aXbXc should become aXbYc;
> I have not found a direct and general way
> of doing it, but there are some solutions…

> I would suggest a new flag like % or $ for it.
> I wonder if the syntax ${(%)str/X/Y} is going
> to conflict with other functionalities of ZSH…

But there is already a '%' flag...
This doesn't merits a new one.

What merits a new one then?


> Adding negative indexes support to the 'I' flag
> would be very good but verbose in my opinion.

Extending the 'I' flag in this way would be ideal.

How do you extend the I flag?


--
https://about.me/dardo82


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