From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1214 invoked by alias); 9 Nov 2016 04:52:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39880 Received: (qmail 1102 invoked from network); 9 Nov 2016 04:52:52 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f179.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.179):SA:0(0.0/5.0):. Processed in 1.157302 secs); 09 Nov 2016 04:52:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.179 as permitted sender) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:to:subject:mime-version; bh=WoQbtlDB8tCEy05+GHpEErWnuwugBR9Xc1vAOdvMVNw=; b=h+idVow6CoGkK5TapkymicjSOQ6UfS0D+8ZKQGvfrnVFtMMWx3c5nsE6KXs2k2xKg/ zf+P/wSrxLTYQ23TCEnHQ+Qbgywaj4EdvclITrHFUQIW+WWYvTc57jf2ylo4AhrJt/qx zAHdKld+iu6vFpMvn5T/temYCIROkxoKCX1E+VrtiIDuBPuYdr9HMdmLi2DE1iR3pmf6 2xjJdrSPdj3aGv5wAH9n6WKGNm8slikA9+EsLm4KfX4gWpPXegrLkEHRbQsMl++DvwRp Fq32Xpmd2LgIDZmidHXIUTtevreJgVZ4MUtL36ewtk2jQA3yDphbtS9ZLFAmjU/O1n/P B3Og== X-Gm-Message-State: ABUngvdWVZvAj/GL4jzKlpAtpvYkmBHxx3r+EXb5WQ+oBIwY2DVggG6wddQzZzGsQFuhhg== X-Received: by 10.176.81.178 with SMTP id g47mr9287116uaa.78.1478628606710; Tue, 08 Nov 2016 10:10:06 -0800 (PST) From: Bart Schaefer Message-Id: <161108101043.ZM10631@torch.brasslantern.com> Date: Tue, 8 Nov 2016 10:10:43 -0800 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: [PATCH] explicitly mention ${name:/pat/repl} MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.