From 698af7bc1387462c8e87767d7eaeb7e30c6f0b2b Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 26 Jan 2024 07:33:38 +0100 Subject: 52405, 52502: add empty elements to $match for optional captures that don't match --- Test/V07pcre.ztst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Test') 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" -- cgit 1.4.1