From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10231 invoked by alias); 16 Oct 2015 05:05:32 -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: 20767 Received: (qmail 15932 invoked from network); 16 Oct 2015 05:05:30 -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=N+eH2B4MVq0GgnHyFdjEml0j4UHNKMTfcicoqj4kK/c=; b=mA8ZvgwgJjJN81ROC3AV7cqMRy0vY5ddE+FfTU5z4KIZ6SqnhL/plZy15X9BQmZTC5 HsvjwJJqUpT+6b7k1/mf01vS3ZN0mTfEBR05wxpCkasvthOn6TJBVMgAbloaQEbGPJoN j7ry8gSB8EC4Tu/bcwC84nbgZQwGgX3lVJI3w2uHRX84ncLINopcHRsZgcat9gECKf3q r+yX0D6Crr5MD1qzD6/5fk7jJMoZabyqN2o4tnQc+bzFBzy4Oyt+uOlEAkdoaO0rcVQh mB2N4P4qy5EUP6t6SlEQvSAxq0JlwZ0D3US6oiQvmflTYgON3fez+ZST2FMXooS5LCB5 aCmg== X-Gm-Message-State: ALoCoQnpRwB7c/dRZEDeeqdCxueoURtvivWPDaiFkGlhCdbh1ZLHCULaRgLGzlsNthvC4z4UAHbO X-Received: by 10.202.223.213 with SMTP id w204mr8019659oig.84.1444971929307; Thu, 15 Oct 2015 22:05:29 -0700 (PDT) From: Bart Schaefer Message-Id: <151015220545.ZM30842@torch.brasslantern.com> Date: Thu, 15 Oct 2015 22:05:45 -0700 In-Reply-To: Comments: In reply to Mikael Magnusson "Re: backreferences" (Oct 16, 6:11am) References: <561FF039.9020202@eastlink.ca> <151015161602.ZM30622@torch.brasslantern.com> <56204FD3.9040500@eastlink.ca> <151015193032.ZM30783@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 16, 6:11am, Mikael Magnusson wrote: } } As a sidenote, (^foo)* is always useless to write, since (^foo) will } expand to the empty string, and then the * will consume anything else. Minor correction ... (^foo) will be the empty string only if the tested string begins with "foo". But then * will consume the "foo", making the (^foo) useless. Conversely if the string does not contain "foo" at all, (^foo) will consume all of it and * will match the empty string. 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]. Which happens to be a lot like what Ray was trying to accomplish. } A useful way to think of (^foo) is a * that will exclude any matches } that don't match the pattern foo. Yes. There's a really long explanation of this in Etc/FAQ 3.27.