From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25585 invoked by alias); 5 Mar 2015 16:44:17 -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: 19974 Received: (qmail 24877 invoked from network); 5 Mar 2015 16:44:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 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=Lmhwsh0elnbXCVkZ+7C+tWefT2h0aIGtrJmnod+FX/A=; b=QuiYvjq10UhsNA+m08hnMWLB2szR0Vq3y1O2qJXvTIVWOoAJnHaeKxhqYN1KPlo7CA tFD5EJij6hsDDTZ33Gbx6GS6iTkl2VI27C7S2hli2RefVer/ZFcmw9qu1xcPBJjiB1LK cxJz+SQzqTSClWiXUP6N9uSXNLZggJWR4PeWTmfOvWLP8YboFDRPPWpyTOc6HW0hOyy+ gRxeUQizS6Eefb+J0eduIdekN3fnv2KiUPmOx3YzncUnyQCCnsdz/c0TOqSceoKlE84U 4bUE6IWYA9CUvs+Kedoh6YDcsSNPsk5qOMFtHFO5ph12YoWAHoLm8sg+8N83mRk1nTLB 8cZQ== X-Gm-Message-State: ALoCoQnn39UKFXfeZ3uJIo8siX4kXoYRUmaUGGmT3V3lDWIGzwYhPrkpkcRJo5jHxpgkOSZVD+6q X-Received: by 10.202.111.131 with SMTP id v3mr7081562oik.133.1425573851744; Thu, 05 Mar 2015 08:44:11 -0800 (PST) From: Bart Schaefer Message-Id: <150305084408.ZM20963@torch.brasslantern.com> Date: Thu, 5 Mar 2015 08:44:08 -0800 In-Reply-To: <20150305083000.GA3294@localhost.localdomain> Comments: In reply to Han Pingtian "wrong array range with (r) flag on scalar?" (Mar 5, 4:30pm) References: <20150305083000.GA3294@localhost.localdomain> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: wrong array range with (r) flag on scalar? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 5, 4:30pm, Han Pingtian wrote: } Subject: wrong array range with (r) flag on scalar? } } Hi, } } Looks like this is wrong: } } localhost% a='hello world' } localhost% print $a[(r)h?] } h } localhost% print $a[(r)h?,(r)w?] } hello wo } localhost% } } In the range, the end should be "w" and the result should be "hello w"? The range goes from the start of the left pattern to the end of the shortest match for the second pattern. This is the only thing that makes sense if the range is going to be "inclusive" of the end of the pattern match. With (R), it's the end of the longest match for the second pattern. Would you expect torch% print $a[(r)h?,(r)wo] hello wo to stop at the "w"? The doc could certainly be more clear about this.