about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2016-11-09 07:50:06 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2016-11-09 07:50:06 -0800
commitdae3116026529790588295241b5a7e57fa96b200 (patch)
tree51451cea697cc87934c36a7bd4be603f4ee4af88
parent65ea1a033b1feeea30d9ad6deca93d6e771904ea (diff)
downloadzsh-dae3116026529790588295241b5a7e57fa96b200.tar.gz
zsh-dae3116026529790588295241b5a7e57fa96b200.tar.xz
zsh-dae3116026529790588295241b5a7e57fa96b200.zip
39882: mention ${name:/pattern/replacement} in the itemized synopsis with the related forms; clarify doc.
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/expn.yo12
2 files changed, 12 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 320ee3fca..9a223e1f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-09  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 39882: Doc/Zsh/expn.yo: mention ${name:/pattern/replacement}
+	in the itemized synopsis with the related forms; clarify doc.
+
 2016-11-09  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 39887: Src/params.c: no need to conditionalise assignment of
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index f465b2f60..87ca7905d 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -782,12 +782,14 @@ prepending tt($0).  Hence tt(${*:0:1}) substitutes tt($0) and
 tt(${*:1:1}) substitutes tt($1).
 )
 xitem(tt(${)var(name)tt(/)var(pattern)tt(/)var(repl)tt(}))
-item(tt(${)var(name)tt(//)var(pattern)tt(/)var(repl)tt(}))(
+xitem(tt(${)var(name)tt(//)var(pattern)tt(/)var(repl)tt(}))
+item(tt(${)var(name)tt(:/)var(pattern)tt(/)var(repl)tt(}))(
 Replace the longest possible match of var(pattern) in the expansion of
 parameter var(name) by string var(repl).  The first form
-replaces just the first occurrence, the second form all occurrences.
+replaces just the first occurrence, the second form all occurrences,
+and the third form replaces only if var(pattern) matches the entire string.
 Both var(pattern) and var(repl) are subject to double-quoted substitution,
-so that expressions like tt(${name/$opat/$npat}) will work, but note the
+so that expressions like tt(${name/$opat/$npat}) will work, but obey the
 usual rule that pattern characters in tt($opat) are not treated specially
 unless either the option tt(GLOB_SUBST) is set, or tt($opat) is instead
 substituted as tt(${~opat}).
@@ -803,8 +805,8 @@ single backslash; this is not necessary if the
 `tt(%)' and `tt(#%) are not active if they occur inside a substituted
 parameter, even at the start.
 
-The first `tt(/)' may be preceded by a `tt(:)', in which case the match
-will only succeed if it matches the entire word.  Note also the
+If, after quoting rules apply, tt(${)var(name)tt(}) expands to an array,
+the replacements act on each element individually.  Note also the
 effect of the tt(I) and tt(S) parameter expansion flags below; however,
 the flags tt(M), tt(R), tt(B), tt(E) and tt(N) are not useful.