From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: wrong array range with (r) flag on scalar?
Date: Thu, 05 Mar 2015 17:06:38 +0000 [thread overview]
Message-ID: <20150305170638.0d10ba1b@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <150305084408.ZM20963@torch.brasslantern.com>
couldn't resist rubbing it in at the end :-)
pws
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index d044f87..7b127bc 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -187,7 +187,17 @@ from the end of the array tt(foo), and
Subscripting may also be performed on non-array values, in which
case the subscripts specify a substring to be extracted.
For example, if tt(FOO) is set to `tt(foobar)', then
-`tt(echo $FOO[2,5])' prints `tt(ooba)'.
+`tt(echo $FOO[2,5])' prints `tt(ooba)'. Note that
+some forms of subscripting described below perform pattern matching,
+and in that case the substring extends from the start of the match
+of the first subscript to the end of the match of the second
+subscript. For example,
+
+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.
subsect(Array Element Assignment)
next parent reply other threads:[~2015-03-05 17:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150305083000.GA3294@localhost.localdomain>
[not found] ` <150305084408.ZM20963@torch.brasslantern.com>
2015-03-05 17:06 ` Peter Stephenson [this message]
2015-03-08 22:53 ` Han Pingtian
2015-03-09 16:37 ` Bart Schaefer
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=20150305170638.0d10ba1b@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-workers@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).