From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21053 invoked by alias); 20 Oct 2015 19:09:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36902 Received: (qmail 26921 invoked from network); 20 Oct 2015 19:09:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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== X-Received: by 10.194.129.129 with SMTP id nw1mr6940866wjb.37.1445368188718; Tue, 20 Oct 2015 12:09:48 -0700 (PDT) Date: Tue, 20 Oct 2015 20:09:46 +0100 From: Stephane Chazelas To: Bart Schaefer Cc: Zsh hackers list Subject: Re: Issue with ${var#(*_)(#cN,M)} Message-ID: <20151020190946.GA6560@chaz.gmail.com> Mail-Followup-To: Bart Schaefer , Zsh hackers list References: <20151019093316.GA6957@chaz.gmail.com> <151019121728.ZM324@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <151019121728.ZM324@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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