From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24442 invoked by alias); 16 Oct 2015 05:28:13 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20768 Received: (qmail 21548 invoked from network); 16 Oct 2015 05:28:12 -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 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=hr7aa2+qfX3mRAmGXFXaQeSJMgckJs0zNy0gkSxORn4=; b=W7vPEcyOj/lUSfoq2m45xWFJhu2u7kg6s8ElUxo/TPGW21DkiTodoS2me4l95N1MCI afSye7IvMwxWwb0edbtdgLmIELrHhbgzMTtMlfJvHN08cjAv8X38dFkD/0oss0kQX9JN EXP8n2YbTYA+OqKZIvUsPrFj4vrMPmyOQ/sx98Vn54eCJmjuakea+4ZWr/UiyG5dVsSx M/Ktgl09/6ymGTq1FMRoGVuW687kMjMFqYoihMF0Fe3ckPsdrVcIGmaVQwAxuMWK/JdE augtRExi1mH9y+Tw2ewf1v45q9lnjIh8iU+pgkbnP0kVWbJ7psEycxa1izPpygcrhTKm Ckaw== X-Gm-Message-State: ALoCoQkcsNYBxP6yH1y3O/hh+u5xDdpY+bFRl5Ia7+FMBA2e8NNP7vCDMpjJjGDb5PH1eYpiiuP3 X-Received: by 10.202.239.136 with SMTP id n130mr3484684oih.88.1444973290773; Thu, 15 Oct 2015 22:28:10 -0700 (PDT) From: Bart Schaefer Message-Id: <151015222827.ZM30858@torch.brasslantern.com> Date: Thu, 15 Oct 2015 22:28:27 -0700 In-Reply-To: <151015220545.ZM30842@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: backreferences" (Oct 15, 10:05pm) References: <561FF039.9020202@eastlink.ca> <151015161602.ZM30622@torch.brasslantern.com> <56204FD3.9040500@eastlink.ca> <151015193032.ZM30783@torch.brasslantern.com> <151015220545.ZM30842@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: backreferences MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 15, 10:05pm, Bart Schaefer wrote: } } However, (^foo)(*) could be very useful with backreferences, because } (^foo) puts everything up to "foo" into $match[1], and then (*) puts } from "foo" to the end into $match[2]. And now I've got two problems instead of one. Because of course (^foo) matches "foobar" even though the latter has "foo" as a prefix. You need (^foo*) to do what I was describing, or (|^foo) which makes sense only if you either know very little about regular expressions or you realize that zsh prefers the leftmost of "|" alternatives over the longest of alternatives.