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).



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