From: Roman Neuhauser <neuhauser@sigpipe.cz>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh-users@zsh.org
Subject: Re: ${name/pattern/repl} with negated pattern
Date: Thu, 15 May 2014 20:18:31 +0200 [thread overview]
Message-ID: <20140515181831.GK1629@isis.sigpipe.cz> (raw)
In-Reply-To: <20140515163219.7b60d531@pwslap01u.europe.root.pri>
# p.stephenson@samsung.com / 2014-05-15 16:32:19 +0100:
> ^ means "anything, and I do mean anything, that doesn't match the
> following pattern". You can see that the initial "x" doesn't match the
> pattern, because the pattern requires the "/" to match. However, x/ or
> anything longer does match the pattern because of the *. So the longest
> string at the head that doesn't match the pattern is "x". So it removes
> that.
thanks, i suspected strongly it was my confusion with the negation.
i'll have to go and get some practice with pattern matching, i used to
do better. and your suggestion of #% is spot on, it does fix it.
> I think you'd be better off with ${a:#^x/*},
agreed.
> So try ${(M)a:#x/*}.
yep, this is IMO easiest.
--
roman
next prev parent reply other threads:[~2014-05-15 18:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-15 12:26 Roman Neuhauser
2014-05-15 15:32 ` Peter Stephenson
2014-05-15 18:18 ` Roman Neuhauser [this message]
2014-05-15 15:45 ` Bart Schaefer
2014-05-15 16:37 ` Roman Neuhauser
2014-05-15 17:16 ` Bart Schaefer
2014-05-15 18:39 ` Roman Neuhauser
2014-05-16 8:40 ` Peter Stephenson
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=20140515181831.GK1629@isis.sigpipe.cz \
--to=neuhauser@sigpipe.cz \
--cc=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).