zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: negative pattern doesn't match empty string in globbing?
Date: Fri, 19 Sep 2014 11:02:41 +0100	[thread overview]
Message-ID: <CAECNH1QENEtGtTwobz3EqofaYCVXvzEPdvT_M=GxvNFnZGQ7Fg@mail.gmail.com> (raw)
In-Reply-To: <20140919080426.GA4265@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

On Friday, 19 September 2014, Han Pingtian <hanpt@linux.vnet.ibm.com
<javascript:_e(%7B%7D,'cvml','hanpt@linux.vnet.ibm.com');>> wrote:
> Hello,
>
> I just notice that negative pattern like this doesn't work:
>
>     localhost% setopt extendedglob
>     localhost% print /usr/**/bin/zsh
>     /usr/bin/zsh /usr/local/bin/zsh

>     localhost% print /usr/^local/bin/zsh
>     zsh: no matches found: /usr/^local/bin/zsh
>     localhost% ls /usr//bin/zsh
>     /usr//bin/zsh
>     localhost%
>
> I think if "^local" can match with empty string, then this should work.
> But looks like it doesn't.

Please excuse formatting,  I'm writing this on a phone on a bus
and have encountered a catalogue of problems...

Negative pattern matches are confusing.

Think about them as "match anything but..."

In other words,  first match something, then decide what to exclude.

In this case the matches are all the files in the directory (and not the
empty string).  So the overall match fails when you try to exclude
everything.

(The keyboard's completion keeps offering 'Scotland'.  Must turn off
trending phrases.)

Hope for a mobile cell soon...

pws

      parent reply	other threads:[~2014-09-19 10:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-19  8:04 Han Pingtian
2014-09-19  9:55 ` Peter Stephenson
2014-09-19 10:02 ` Peter Stephenson [this message]

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='CAECNH1QENEtGtTwobz3EqofaYCVXvzEPdvT_M=GxvNFnZGQ7Fg@mail.gmail.com' \
    --to=p.w.stephenson@ntlworld.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).