about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2023-05-13 00:56:48 +0200
committerOliver Kiddle <opk@zsh.org>2023-05-13 00:56:48 +0200
commitf3f371deb376478176866fd770fbcf9bc0d0609f (patch)
treef52fbb7f254b7b2e8570eb3f7c17bbfcfd93e64c /Test
parentb62e911341c8ec7446378b477c47da4256053dc0 (diff)
downloadzsh-f3f371deb376478176866fd770fbcf9bc0d0609f.tar.gz
zsh-f3f371deb376478176866fd770fbcf9bc0d0609f.tar.xz
zsh-f3f371deb376478176866fd770fbcf9bc0d0609f.zip
51728: assign pcre named capture groups to a hash
Diffstat (limited to 'Test')
-rw-r--r--Test/V07pcre.ztst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst
index 6eb366964..027fea3aa 100644
--- a/Test/V07pcre.ztst
+++ b/Test/V07pcre.ztst
@@ -182,3 +182,17 @@
   [[ abc =~ 'a(d*)bc' ]] && print "$#MATCH; $#match; ${#match[1]}"
 0:empty capture
 >3; 1; 0
+
+  [[ category/name-12345 =~ '(?x)^
+    (?<category> [^/]* ) /
+    (?<package>
+      (?<name> \w+ ) -
+      (?<version> \d+ ))$' ]]
+  typeset -p1 .pcre.match
+0:named captures
+>typeset -g -A .pcre.match=(
+>  [category]=category
+>  [name]=name
+>  [package]=name-12345
+>  [version]=12345
+>)