From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16207 invoked by alias); 9 Nov 2016 07:39:08 -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: 39882 Received: (qmail 15947 invoked from network); 9 Nov 2016 07:39:08 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f68.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.213.68):SA:0(0.0/5.0):. Processed in 0.57919 secs); 09 Nov 2016 07:39:08 -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.213.68 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:in-reply-to:comments:references:to:subject :mime-version; bh=At4RiR91dqkxvYlF6uF9A5Pb9hJuC0LhposGc4Bq8OI=; b=OccgNGbdfRCzewJ4uH3sVTEzp3GfvjTanY/i7UW/gvV4KxZMOlvY7rJSvi4op6iMhj 820J74UcqDFmNh/CJ2ySTx4bVdjmtN89s05OIkwU1fPii3K9hBiJCmHDw3pWysxDYW6A t3bTYYDft4y3BulpvEEuU4YCHh29+7tj3yBHaCC/sLxpkpkCOfJVWSaZp/lt6dNE5K9c 950l2aPjmOZx/7iOeje9mUy8ePDo/HYXesQKUXSgxxM3YpGZEx4bxAQ3LA3FWjYURixA KxvCPV1m8DgQp8MGKucVIzuhku83IEOhUVxQIR8RaL8D7pkC+Yv7oRLJSgL1B0YMaHZy xCEg== 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:in-reply-to:comments :references:to:subject:mime-version; bh=At4RiR91dqkxvYlF6uF9A5Pb9hJuC0LhposGc4Bq8OI=; b=bqxay7UzEeQnw/tXWo1lRO22x+ulzHyjT+0CdnYWMP5g62hG5rPjFaHAMczsqn2x2M mIp5b/Wh6wbEUuOLbawaA+bgQjEODz6WWJ1kkbN9K0qKMs9terInoLSdsSl35q++iD3E LXhYlf/6olrqONLMRnuXmCI0vj4NCWFTXfWJPGHmgeMBCbY1llCYoW9c35SRCNNUa0nw PqyhtlusxBxZNYVNe1QtCKWKL3qWLMWYmU4qLiwaNz5wgKYwLSkQmILxFumQbV4/zdUl io4yeBzVMMkxoSZqDEiH4G8oAP9G/lJyI5eSxwhd8lxBLskUE6uxlvvVHYhUBSGkiS/5 WB9w== X-Gm-Message-State: ABUngvdZ9Wo5TLNtYtBmtSswOaGHj6c5nRvr76cD9ZNb8F0mF4aKa2safhio+IADHKT03A== X-Received: by 10.31.114.207 with SMTP id n198mr11719342vkc.129.1478676174545; Tue, 08 Nov 2016 23:22:54 -0800 (PST) From: Bart Schaefer Message-Id: <161108232252.ZM4190@torch.brasslantern.com> Date: Tue, 8 Nov 2016 23:22:52 -0800 In-Reply-To: <161108223934.ZM12195@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: [PATCH] explicitly mention ${name:/pat/repl}" (Nov 8, 10:39pm) References: <161108101043.ZM10631@torch.brasslantern.com> <20161109051419.GA21675@fujitsu.shahaf.local2> <161108223934.ZM12195@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [PATCH] explicitly mention ${name:/pat/repl} MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 8, 10:39pm, Bart Schaefer wrote: } } It just means that if you quote the expansion, it won't necessarily } be an array any more. There are too many ways this could happen to } enumerate them all every time it might apply. How about this, then. diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index f465b2f..87ca790 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.