Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Issue with ${var#(*_)(#cN,M)}
- X-seq: zsh-workers 36902
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Issue with ${var#(*_)(#cN,M)}
- Date: Tue, 20 Oct 2015 20:09:46 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=mKUvCgJ8FPuHjt9UrYlDIPPByu8oB1xMVrO0fFXSo9M=; b=D188CoilFjpYm8Q0n7+eTTl9TM0cIRBCDvI8AMzWm/kdsev/Liu7KFgyvc+rxNUgSS obPmc0Ba85xe7xZVKb3AbbFvZuQa1KEJhBRJ/Cv7aE3DT/s07jdHJrk7P3EjYbJ++nw4 FWJNmsR3+xOE50ubFxo+/sGIjlnRPK1LLjBRC5CPf5PfKDySAjEtfciaoR+UThA+O+Us eM4taE7pF6seZS3M0CfpLEftMxUb5d96ZstFCU99qNquvmjdBTSisyQeTNT7+XXza4Hr BHmlZHG1XE223KH3FthYyDv1lTJWyV6lEM9il7XtULhe0XSoGeka5HuTwCvZKzozXGtL UBqA==
- In-reply-to: <151019121728.ZM324@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20151019093316.GA6957@chaz.gmail.com> <151019121728.ZM324@torch.brasslantern.com>
2015-10-19 12:17:28 -0700, Bart Schaefer:
> On Oct 19, 10:33am, Stephane Chazelas wrote:
> } Subject: Issue with ${var#(*_)(#cN,M)}
> }
> } Unless I'm missing something, this looks like a bug:
>
> Hm. I think it's counting the number of times it backtracked. E.g.
>
> } ~$ a='1_2_3_4_5_6'
> } ~$ echo ${a#(*_)(#c2)}
> } 2_3_4_5_6
>
> Here, it first matched "1_2_3_4_5_" but then couldn't match a second
> time, so it backtracked, matched "1_", and stopped counting.
[...]
Note that the:
~$ echo ${a#*_*_}
3_4_5_6
~$ echo ${a#*_*_*_}
4_5_6
work OK.
And also:
~$ echo ${a#(*_)(*_)(*_|)}
3_4_5_6
~$ echo ${a#(*_)(*_)(*_|)4}
_5_6
(equivalent of (#c2,3))
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author