From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 32C28247D6 for ; Thu, 25 Jan 2024 23:14:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date: Content-Transfer-Encoding:Content-ID:Content-Type:MIME-Version:Subject:To: References:From:In-reply-to:cc:Reply-To:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=XNRbg7ypzWriYx8PZH5cWbzzPd8yRMx5ZfwdHW3n1bk=; b=r9JKhLjhfg3jvBWiv9qOGtiWw/ h3o6KNx/39uMmB4LXcsXPpnCQ3jZPMp2TkemYcS6G+S8ufUpgnBc7VGzaj2K7iD8DR8SgZDPZUGpy 6TaF6Xk2AjV5aegCMV5pRRi0y6J66U0ms909sVorPHvchyu5MPcrsDm0QDnWZ69hxG8rJuCT1TL2Q FYH9CPQk5Jua4nLuPzf2K8CmvzO+uhmqF90oC79LVYE1asi81tSImlOhdOl3RKn5r/LW5BfiVH2ea BCWDNtsexxDcqGFcZUSsh59Nwo1OaTllo72abUYZsOPzaVDn8pVz9lcuRnIOHesfgpbWh4jI6tGTm FQ+SMU/w==; Received: by zero.zsh.org with local id 1rT7zo-000G9k-2K; Thu, 25 Jan 2024 22:14:52 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rT7zX-000FpK-Of; Thu, 25 Jan 2024 22:14:36 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.97.1) (envelope-from ) id 1rT7zW-00000000JvZ-1QVD; Thu, 25 Jan 2024 23:14:35 +0100 cc: Zsh hackers list In-reply-to: From: Oliver Kiddle References: <34734-1702338590.864931@1x0T.Klos.9utN> To: Bart Schaefer Subject: =?UTF-8?Q?Re:_[PATCH=3F]_Re:_[BUG]_`$match`_is_haunting_my_regex?= =?UTF-8?Q?=E2=80=99s_trailing,_optional,_capture?= MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <76603.1706220874.1@hydra> Content-Transfer-Encoding: 8bit Date: Thu, 25 Jan 2024 23:14:34 +0100 Message-ID: <76604-1706220874.334202@5f0E.FnU8.oa7O> X-Seq: 52502 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 11 Dec, Bart Schaefer wrote: > On Mon, Dec 11, 2023 at 3:49 PM Oliver Kiddle 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"