Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH v3] regexp-replace and ^, word boundary or look-behind operators (and more).
- X-seq: zsh-workers 52722
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH v3] regexp-replace and ^, word boundary or look-behind operators (and more).
- Date: Sat, 9 Mar 2024 13:03:10 +0000
- Archived-at: <https://zsh.org/workers/52722>
- In-reply-to: <20240308153050.u63fqtcjyr2yewye@chazelas.org>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- References: <20191216211013.6opkv5sy4wvp3yn2@chaz.gmail.com> <20191216212706.i3xvf6hn5h3jwkjh@chaz.gmail.com> <20191217073846.4usg2hnsk66bhqvl@chaz.gmail.com> <20191217111113.z242f4g6sx7xdwru@chaz.gmail.com> <2ea6feb3-a686-4d83-ab27-6a582424487c@www.fastmail.com> <20200101140343.qwfx2xaojumuds3d@chaz.gmail.com> <20210430061117.buyhdhky5crqjrf2@chazelas.org> <CAH+w=7bHxSbFr60ZU0+oZ6+qEejhfBYTzvL7=aXadY5XzWtSzw@mail.gmail.com> <20210505114521.bemoiekpophssbug@chazelas.org> <20240308153050.u63fqtcjyr2yewye@chazelas.org>
2024-03-08 15:30:50 +0000, Stephane Chazelas:
[...]
> So here's a v4 that should address that, some of the objections
> to v2 and uses namerefs to replace that illegible usage
> of positional parameters for local variables
[...]
Scratch that, we do have to use positional parameters or
namespacing as expansions are performed in the replacement so
the users could do:
regexp-replace var $regexp '$start[$#MATCH]$regexp'
For instance, and expect the $start / $regexp in the replacement
to be *their* variable, not the local variables of
regexp-replace.
I'll send a v6 likely using namespaced variables rather than
going back to using positional parameters, once I understand the
point of using .regexp_replace.myvar over _regexp_replace_myvar
(TBH, ATM I don't).
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author