zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: difference between ~ & ^ negation
Date: Thu, 02 Jan 2014 23:37:26 -0800	[thread overview]
Message-ID: <140102233726.ZM10543@torch.brasslantern.com> (raw)
In-Reply-To: <CAHYJk3Sk=AorY+rX6yNC+DNXnrH_9Z=PTjsO=irPrv3rg9KrTA@mail.gmail.com>

On Jan 3,  2:55am, Mikael Magnusson wrote:
}
} I think of ^foo as a * that won't match "foo", so you can have
} foo/bar^baz and it would match bar* but not barbaz, and if you think
} of it like that it's not really that confusing. ^foo/^bar is then just
} */* that won't match */bar or foo/*.

Unfortunately that's only helpful for understanding globbing, because in
pattern matching, ^foo/^bar is like * that won't match any foo/* except
specifically foo/bar.  As Peter said, it's implicitly ^(foo/^(bar)) in a
pattern; whereas it's (^(foo))/(^(bar)) in a glob.

There's no other "wildcard" with that weird difference in precedence in
the two cases.  The others differ only on whether "/" is an ordinary
character.  This is what fooled me into thinking it didn't work at all
in a pattern match; I assumed ^foo/^bar was two consecutive expressions,
(^foo/)(^bar), so I constructed the wrong test strings.


  reply	other threads:[~2014-01-03  7:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-01 15:28 zzapper
2014-01-01 21:44 ` Bart Schaefer
2014-01-02 21:01   ` Peter Stephenson
2014-01-02 21:36     ` Bart Schaefer
2014-01-02 22:14       ` Peter Stephenson
2014-01-03  1:55       ` Mikael Magnusson
2014-01-03  7:37         ` Bart Schaefer [this message]
2014-01-03 19:48           ` Peter Stephenson
2014-01-03 20:10             ` Peter Stephenson
2014-01-03 21:43               ` Bart Schaefer
2014-01-04 21:11                 ` zzapper
2014-01-05 10:01                   ` Eike von Seggern
     [not found] ` <8lp61n01B02mHnv01lp8uc>
2014-01-03 20:56   ` how to shut off auto spell steve
2014-01-03 21:52     ` Bart Schaefer
     [not found]     ` <9ZwH1n01Z02mHnv01ZwLWZ>
2014-01-03 22:07       ` steve

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=140102233726.ZM10543@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).