From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17835 invoked by alias); 3 Jan 2014 07:37:47 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18269 Received: (qmail 12539 invoked from network); 3 Jan 2014 07:37:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140102233726.ZM10543@torch.brasslantern.com> Date: Thu, 02 Jan 2014 23:37:26 -0800 In-reply-to: Comments: In reply to Mikael Magnusson "Re: difference between ~ & ^ negation" (Jan 3, 2:55am) References: <140101134459.ZM8931@torch.brasslantern.com> <20140102210147.0eca0601@pws-pc.ntlworld.com> <140102133636.ZM10014@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: difference between ~ & ^ negation MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.