zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-user <zsh-users@zsh.org>
Subject: Re: (r) flag on scalar
Date: Sun, 8 Mar 2015 19:56:42 -0700	[thread overview]
Message-ID: <150308195642.ZM11614@torch.brasslantern.com> (raw)
In-Reply-To: <20150308233821.GB2746@localhost.localdomain>

On Mar 9,  7:38am, Han Pingtian wrote:
} Subject: (r) flag on scalar
}
} I think below command line should give result "bc", but:
} 
} localhost% s=abcdefg
} localhost% print $s[(r)bc]
} b
} localhost%
} 
} Looks like this isn't intuitional.

$s[(r)bc] is a single index, so it's the index where the first match for
"bc" begins.

$s[(r)bc,(r)ef] is a range of indices, so it begins where "bc" begins and
ends where "ef" ends.

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.


  reply	other threads:[~2015-03-09  2:57 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 [this message]
2015-03-09  9:08   ` Peter Stephenson
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=150308195642.ZM11614@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).