zsh-users
 help / color / mirror / code / Atom feed
From: Dan Nelson <dnelson@allantgroup.com>
To: "Larry P. Schrof" <larry@schrof.net>
Cc: zsh-users@sunsite.dk
Subject: Re: Question on array processing.
Date: Wed, 4 Oct 2006 15:10:18 -0500	[thread overview]
Message-ID: <20061004201018.GH54791@dan.emsphone.com> (raw)
In-Reply-To: <20061004200759.GG54791@dan.emsphone.com>

In the last episode (Oct 04), Dan Nelson said:
> In the last episode (Oct 04), Larry P. Schrof said:
> > I'm tring to do something like:
> > 
> > > str="these:are:some:words"
> > > echo ${str[(ws:::)2]}
> > zsh: bad math expression: operand expected at `::)2'
> > 
> > I've also tried :":":, :\::, and :':': - none of those work.
> > 
> > Is this a small flaw / hole in zsh's functionality?
> 
> You can use any character as a delimiter, not just a colon:
> 
> $ str="these:are:some:words"
> $ echo ${str[(ws/:/)2]}
> are

Forgot to include the documentation that mentions this:

       The following flags (except p) are followed by one or more
       arguments as shown.  Any character, or the matching pairs
       `(...)', `{...}', `[...]', or `<...>', may be used in place of a
       colon as delimiters, but note that when a flag takes more than
       one argument, a matched pair of delimiters must surround each
       argument.


-- 
	Dan Nelson
	dnelson@allantgroup.com


  reply	other threads:[~2006-10-04 20:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-04 20:00 Larry P. Schrof
2006-10-04 20:07 ` Dan Nelson
2006-10-04 20:10   ` Dan Nelson [this message]
2006-10-04 20:20     ` Larry P. Schrof
2006-10-04 20:18   ` Larry P. Schrof

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=20061004201018.GH54791@dan.emsphone.com \
    --to=dnelson@allantgroup.com \
    --cc=larry@schrof.net \
    --cc=zsh-users@sunsite.dk \
    /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).