From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28824 invoked by alias); 9 Mar 2015 09:08:39 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19985 Received: (qmail 15235 invoked from network); 9 Mar 2015 09:08:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc86d0000066b7-4e-54fd6279a80f Date: Mon, 09 Mar 2015 09:08:15 +0000 From: Peter Stephenson To: zsh-user Subject: Re: (r) flag on scalar Message-id: <20150309090815.004678df@pwslap01u.europe.root.pri> In-reply-to: <150308195642.ZM11614@torch.brasslantern.com> References: <20150308233821.GB2746@localhost.localdomain> <150308195642.ZM11614@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKLMWRmVeSWpSXmKPExsVy+t/xq7qVSX9DDCbts7TYcXIlowOjx6qD H5gCGKO4bFJSczLLUov07RK4Mtac+MBe8ICr4tu2bUwNjC85uhg5OSQETCTmztrMCGGLSVy4 t56ti5GLQ0hgKaNE1/bbTBDOIiaJN2tfM0I42xglTsxoBmthEVCVOPivmx3EZhMwlJi6aTZY XERAQaLpyGJWEFtYQF5i25NlYHFeAXuJ9mUHweKcAlYSe56DrOYAGpop0fU8HyTML6AvcfXv JyaIi+wlZl45A9UqKPFj8j0WEJtZQEti87YmVghbXmLzmrfMILaQgLrEjbu72ScwCs1C0jIL ScssJC0LGJlXMYqmliYXFCel5xrpFSfmFpfmpesl5+duYoQE7dcdjEuPWR1iFOBgVOLhdRD5 EyLEmlhWXJl7iFGCg1lJhFc/7G+IEG9KYmVValF+fFFpTmrxIUYmDk6pBsay9G9rJ5z33yDk r+Fz472weciH8/znb60p/xgz596ce6G/Zmo78E9aWumdHrBa5cixtHuSgsy/PKfZG/9Qef7h W93njsgJVV+viJ4K/7fr1t2KmUee+ccf+/lOWnrdaaGlk/gbDVe/P8k58TOXwAxhf+YpZlke +w6fOP56f9fjfe4dOS+3fJp3RImlOCPRUIu5qDgRAOXcm7M4AgAA On Sun, 8 Mar 2015 19:56:42 -0700 Bart Schaefer wrote: > The only thing not quite intuitive about this is that a wildcard (either > * or with extendedglob ?# ) at the end of the ending patterrn is not > considered part of the match for (r) but is part of the match for (R). > PWS's latest doc tweak still doesn't explicitly describe that. diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index 7b127bc..1b175b2 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 chracters +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)