Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH?] Re: [BUG] `$match` is haunting my regex’s trailing, optional, capture
- X-seq: zsh-workers 52502
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH?] Re: [BUG] `$match` is haunting my regex’s trailing, optional, capture
- Date: Thu, 25 Jan 2024 23:14:34 +0100
- Archived-at: <https://zsh.org/workers/52502>
- In-reply-to: <CAH+w=7a3fdXQP+2StR23W=7jCJJ02tC4QjnRi-Tq2=xXOMY84g@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <A231AE39-13BE-487E-AE31-AF35F2891A8C@gmail.com> <CAH+w=7b8tF16GhZvpcF8urVV-tAAY6DHFRwp=7QNUfA27QxJhA@mail.gmail.com> <CAH+w=7bSrq8p8-LNbn-M-Fkigo1GP3S=5+uXho5zw3bJxXBbBQ@mail.gmail.com> <34734-1702338590.864931@1x0T.Klos.9utN> <CAH+w=7a3fdXQP+2StR23W=7jCJJ02tC4QjnRi-Tq2=xXOMY84g@mail.gmail.com>
On 11 Dec, Bart Schaefer wrote:
> On Mon, Dec 11, 2023 at 3:49 PM Oliver Kiddle <opk@xxxxxxx> wrote:
> >
> > diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c
>
> So is this instead of my patch or as well?
Instead. Sorry for not getting back sooner. I had forgotten this. The
following adds a test case.
Oliver
diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst
index 585698d05..b8cd31c96 100644
--- a/Test/V07pcre.ztst
+++ b/Test/V07pcre.ztst
@@ -108,6 +108,11 @@
>0 xo→t →t
>0 Xo→t →t
+ [[ foo =~ (pre)?f(o*)(opt(i)onal)?(y)* ]]
+ typeset -p match
+0:Empty string for optional captures that don't match
+>typeset -g -a match=( '' oo '' '' '' )
+
string="The following zip codes: 78884 90210 99513"
pcre_compile -m "\d{5}"
pcre_match -b -- $string && print "$MATCH; ZPCRE_OP: $ZPCRE_OP"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author