Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
regexp-replace and ^, word boundary or look-behind operators
- X-seq: zsh-workers 45053
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: regexp-replace and ^, word boundary or look-behind operators
- Date: Mon, 16 Dec 2019 21:10:13 +0000
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
The way regexp-replace works means that these things:
$ a='aaab'; regexp-replace a '^a' x; echo "$a"
xxxb
$ a='abab'; regexp-replace a '\<ab' '<$MATCH>'; echo $a
<ab><ab>
$ set -o rematchpcre
$ a=xxx; regexp-replace a '(?<!x)x' y; echo $a
yyy
don't work properly as after the first substitution, the regex
is no longer matched on the full subject, but on the part of
subject after the last match.
I don't think that can be fixed without exposing more of the
regex/pcre C API.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author