about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2024-01-26 07:33:38 +0100
committerOliver Kiddle <opk@zsh.org>2024-01-26 07:33:38 +0100
commit698af7bc1387462c8e87767d7eaeb7e30c6f0b2b (patch)
tree1c21f23ef05fc90b5747e41c5d7d0915f9096071 /Test
parent742049a4cbd9c4f1683081cb812aef994415f112 (diff)
downloadzsh-698af7bc1387462c8e87767d7eaeb7e30c6f0b2b.tar.gz
zsh-698af7bc1387462c8e87767d7eaeb7e30c6f0b2b.tar.xz
zsh-698af7bc1387462c8e87767d7eaeb7e30c6f0b2b.zip
52405, 52502: add empty elements to $match for optional captures that don't match
Diffstat (limited to 'Test')
-rw-r--r--Test/V07pcre.ztst5
1 files changed, 5 insertions, 0 deletions
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"