about summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-08-01 17:35:17 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-08-01 17:35:17 +0000
commitba22472b7f16b696cc4251fab090652d31308e66 (patch)
tree6c7335d41e7cd11e838dcc846175482942547a65 /Doc
parent1e7c19eca344f45b0f938066882c6aba4d2b9862 (diff)
downloadzsh-ba22472b7f16b696cc4251fab090652d31308e66.tar.gz
zsh-ba22472b7f16b696cc4251fab090652d31308e66.tar.xz
zsh-ba22472b7f16b696cc4251fab090652d31308e66.zip
22573: smooth interface to history-beginning-search-menu
document how to quote metacharacters for reverse array subscript
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/params.yo12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 9212f8593..fe005ed21 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -211,6 +211,18 @@ example (assuming the option tt(KSH_ARRAYS) is not in effect):
 example([[ ${array[(i)pattern]} -le ${#array} ]])
 
 If tt(KSH_ARRAYS) is in effect, the tt(-le) should be replaced by tt(-lt).
+
+Note that in subscripts with both `tt(r)' and `tt(R)' pattern characters
+are active even if they were substituted for a parameter (regardless
+of the setting of tt(GLOB_SUBST) which controls this feature in normal
+pattern matching).  It is therefore necessary to quote pattern characters
+for an exact string match.  Given a string in tt($key), and assuming
+the tt(EXTENDED_GLOB) option is set, the following is sufficient to
+match an element of an array tt($array) containing exactly the value of
+tt($key):
+
+example(key2=${key//(#m)[\][+LPAR()+RPAR()\\*?#<>]/\\$MATCH}
+print ${array[(R)$key2]})
 )
 item(tt(R))(
 Like `tt(r)', but gives the last match.  For associative arrays, gives