Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] explicitly mention ${name:/pat/repl}
- X-seq: zsh-workers 39880
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] explicitly mention ${name:/pat/repl}
- Date: Tue, 8 Nov 2016 10:10:43 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version; bh=WoQbtlDB8tCEy05+GHpEErWnuwugBR9Xc1vAOdvMVNw=; b=wSnfLlvKX1wkD/aAw0NXCto1KVnBmODkKAAY98UDZLPpDo5sV//k2FcSQdsRZ5hWxc M4T9zr0eC19Xj6LOFQbpgBW9Putw188uaCDtVZYDArrVtmXE08eAcTZSLrgJ1ZKDAs2r HCve++AGRkxQZYGBEUbYV+jawpFwvZvQRWVz9Xu2Lsa+u1YsYEKcCyBcMloIjKJZl99q SobTjokNWSx0yg5UkVmW+MjXMYMlb7uFGbrhpZRSpIAGMjQAYsyjRrZAwAn1gOwHjsEp VCZnfTFLWtgkTCzxsiZHM/QUOtJGfRcBGJQUyxdr+OPe4lwDKR/Wo1RIRmWRDMT4Jk7O eBAg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
I was annoyed how hard it was to search the docs for this.
Any inaccuracies? Objections?
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index f465b2f..f67796f 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 tt(${)var(name)tt(}) expands to an array value, the replacements act
+on each element individually. Quoting may affect this. 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author