about summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-03-10 12:19:26 +0000
committerPeter Stephenson <pws@zsh.org>2015-03-10 12:20:47 +0000
commite85906ebc970be9c5114f10dd5869c5cdaca9a65 (patch)
treec706370bdb40e8d40d4609964473f2370417f1bb /Doc
parent57be7b743fbd7afb86edaac3ac86ef34182f86b9 (diff)
downloadzsh-e85906ebc970be9c5114f10dd5869c5cdaca9a65.tar.gz
zsh-e85906ebc970be9c5114f10dd5869c5cdaca9a65.tar.xz
zsh-e85906ebc970be9c5114f10dd5869c5cdaca9a65.zip
users/19985: improve doc of subscripting substrings further
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/params.yo12
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 7b127bc68..2f789209e 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -197,7 +197,17 @@ example(string="abcdefghijklm"
 print ${string[+LPAR()r+RPAR()d?,+LPAR()r+RPAR()h?]})
 
 prints `tt(defghi)'.  This is an obvious generalisation of the
-rule for single-character matches.
+rule for single-character matches.  For a single subscript,
+only a single character is referenced (not the range of characters
+covered by the match).
+
+Note that in substring operations the second subscript is handled
+differently by the tt(r) and tt(R) subscript flags: the former takes the
+shortest match as the length and the latter the longest match.  Hence
+in the former case a tt(*) at the end is redundant while in
+the latter case it matches the whole remainder of the string.  This
+does not affect the result of the single subscript case as here the
+length of the match is irrelevant.
 
 subsect(Array Element Assignment)