From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19216 invoked by alias); 30 Oct 2015 14:58:37 -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: 37023 Received: (qmail 29311 invoked from network); 30 Oct 2015 14:58:36 -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=UCl2jUGqfjT4pwIVQ6pvHt9VhOdQrOXxpH/4GdtkF+4=; b=QAVfklCond+4XdnVjtz8BIjeNCA+BCTR16kp0G+DuStsWYi/8Yt0F4nruswJkYB7ZK 9QTib3lVUqxP8BgHjqUTjLLUAAaDCD7UUnIgR7b4BcmiP7tGc63eRWXMYCewRzZ36iTR /tIL4NoC6c/Hs414HHF8PHzcnGnoYoUGAje4I0RAoPcV3nYB0n8/SXmTSxZZKF0Jgxm8 WRNqPVLxK49I8zV/dZBryyxXDPPY/7uqZsa3/7GEY4T3BSUkna9wC9A/xZU5CJ6tvsX0 LGiC/ceVVyPJD7NdwikDyj6y/okZy1kRk/nuuYnszN47X17J7HEn0h4gSrKNQAIsL8Py 85rA== X-Received: by 10.28.212.8 with SMTP id l8mr4017574wmg.32.1446215243827; Fri, 30 Oct 2015 07:27:23 -0700 (PDT) Date: Fri, 30 Oct 2015 14:27:21 +0000 From: Stephane Chazelas To: Bart Schaefer Cc: Zsh hackers list Subject: Re: regexp-replace and ^ Message-ID: <20151030142721.GA9766@chaz.gmail.com> Mail-Followup-To: Bart Schaefer , Zsh hackers list References: <20151029190807.GA18037@chaz.gmail.com> <151029164635.ZM18026@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <151029164635.ZM18026@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) 2015-10-29 16:46:35 -0700, Bart Schaefer: > On Oct 29, 7:08pm, Stephane Chazelas wrote: > } > } Or maybe have a (E) for ERE and (P) for PCRE parameter expansion flags > } for the ${var//pattern/replacement}. > > Each of (E) and (P) already means something else. Indeed. Bummer. How about some (#E), (#P)? ksh93 has some ~(E:regexp) ~(P:pcre) and ~(E)regexp, ~(P)pcre. Probably a lot more complicated. A pcre_subst builtin addition to the zsh/pcre module would probably be easy. Or a zsubst with several options for pattern/ERE/PCRE, case insensitive... > It ought to be possible to fix regexp-replace. A leading "^" isn't that > difficult, it just means the loop should only go around once (unless you > expect it to match after embedded newlines). The tokens that match word > breaks require more thought. I'm not sure what to make of lookaheads. Well, there's also: (foo|^) and variations where you still want to loop. -- Stephane >