From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4758 invoked by alias); 9 Mar 2015 02:57:08 -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: 19984 Received: (qmail 20359 invoked from network); 9 Mar 2015 02:56:53 -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=kWuW3xjmVnVov27/RRJJoT5d/iLehMgkE8tr6g+9eSg=; b=iBQUQ8IfrtpkolUHwX7htxKQ3W1LLdZPkIVx5frmXCgsn1x01AyJsmtQYCB5PK8GOn qwKtARFlyNKn6EX7r4n3dh8xAxf/eeojNMZkZLSeKrKTnEgUY2/l3dm0Ys+cTPqzy65w g8l4OveFnBVdlRwKW3DY9UKeGheUDsrJZJXY3QVTwQAGHBJYB/46SHRmIJHN3vQ9XOZY WMA+Vavu4xiVliM7f7w9atGocPd/jYsmgBh3KzRHUWs+ZsVYPmOlIRjEm/HEn6EhS45T kt4Z7O9XMVkjWu2vcShoPEG343gRzmqm2ZmmkEhRoAHidIQ+h0LsYAa8KFOhlfmfhXCR fuew== X-Gm-Message-State: ALoCoQkYP8IKcIrbzfbRoTTid87gs2bsqrvMDqjgEwCCFfGjIlYB/1/TTZG3Rxn9QrvEpchWfoWN X-Received: by 10.182.121.162 with SMTP id ll2mr19513873obb.71.1425869805936; Sun, 08 Mar 2015 19:56:45 -0700 (PDT) From: Bart Schaefer Message-Id: <150308195642.ZM11614@torch.brasslantern.com> Date: Sun, 8 Mar 2015 19:56:42 -0700 In-Reply-To: <20150308233821.GB2746@localhost.localdomain> Comments: In reply to Han Pingtian "(r) flag on scalar" (Mar 9, 7:38am) References: <20150308233821.GB2746@localhost.localdomain> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-user Subject: Re: (r) flag on scalar MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 9, 7:38am, Han Pingtian wrote: } Subject: (r) flag on scalar } } I think below command line should give result "bc", but: } } localhost% s=abcdefg } localhost% print $s[(r)bc] } b } localhost% } } Looks like this isn't intuitional. $s[(r)bc] is a single index, so it's the index where the first match for "bc" begins. $s[(r)bc,(r)ef] is a range of indices, so it begins where "bc" begins and ends where "ef" ends. The only thing not quite intuitive about this is that a wildcard (either * or with extendedglob ?# ) at the end of the ending patterrn is not considered part of the match for (r) but is part of the match for (R). PWS's latest doc tweak still doesn't explicitly describe that.