zsh-workers
 help / color / mirror / code / Atom feed
From: Andrej Borsenkow <borsenkow.msk@sni.de>
To: Peter Stephenson <pws@ifh.de>
Cc: Zsh hackers list <zsh-workers@math.gatech.edu>, zsh@peak.org
Subject: Re: PATCH: zsh 3.x: <..> ranges in globbing
Date: Mon, 12 Jan 1998 19:16:55 +0300 (MSK)	[thread overview]
Message-ID: <Pine.SV4.3.95.980112190642.11157B-100000@itsrm1> (raw)
In-Reply-To: <199801121113.MAA25513@sgi.ifh.de>

On Mon, 12 Jan 1998, Peter Stephenson wrote:

> 
> You should probably note that <100->0foo won't match 1000foo, since
> the 1000 gets swallowed up before the shell even knows it's going
> to have to match another digit next. This is a much more difficult
> problem requiring backtracking.  I could make a special case so that
> simple things like this work, but expressions like <100->(0|bar)foo would
> require much more fiddling.  (Of course, <100-999>0foo works now.)

I am not sure, that it is right thing. The <m-n> can (always?) be
rewritten using plain extended regular expression. In particular, <100->
is the same as

  [1-9][0-9][0-9]|[1-9][0-9]{3,}

given file foo with
100foo
1000foo

at my system I get

egrep '([1-9][0-9][0-9]|[1-9][0-9]{3,})0foo' foo
=> 1000foo

egrep '([1-9][0-9][0-9]|[1-9][0-9]{3,})foo' foo
=> 100foo
   1000foo

X/OPEN (and presumably POSIX and Unix 95) also require BRE and ERE to
match the longest possible string - in case of 1000foo the longest
possible is the whole word :-)

Actually, what about replacing "ad hoc" code in ZSH by direct translation
into normal regexp? It will probably be faster (who knows) and will give
ZSH full power to support i18n - wich is currently not (portably)
possible. I think, that <m-n> globbing is the only non-trivial part - all
others are pretty sraightforward.

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



  reply	other threads:[~1998-01-12 16:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-31  5:56 Geoff Wing
1997-12-31  6:17 ` Geoff Wing
1998-01-12 11:13   ` PATCH: zsh 3.x: " Peter Stephenson
1998-01-12 16:16     ` Andrej Borsenkow [this message]
1998-01-12 16:59       ` Peter Stephenson
1998-01-12 17:10       ` Andrew Main
1998-01-12 17:50         ` Andrej Borsenkow
1997-12-31 21:37 ` Wessel Dankers

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=Pine.SV4.3.95.980112190642.11157B-100000@itsrm1 \
    --to=borsenkow.msk@sni.de \
    --cc=pws@ifh.de \
    --cc=zsh-workers@math.gatech.edu \
    --cc=zsh@peak.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).