From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-user <zsh-users@zsh.org>
Subject: Re: (r) flag on scalar
Date: Mon, 09 Mar 2015 09:08:15 +0000 [thread overview]
Message-ID: <20150309090815.004678df@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <150308195642.ZM11614@torch.brasslantern.com>
On Sun, 8 Mar 2015 19:56:42 -0700
Bart Schaefer <schaefer@brasslantern.com> 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)
next prev parent reply other threads:[~2015-03-09 9:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-08 23:38 Han Pingtian
2015-03-09 2:56 ` Bart Schaefer
2015-03-09 9:08 ` Peter Stephenson [this message]
2015-03-09 18:45 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150309090815.004678df@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).