From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13528 invoked from network); 3 Feb 2021 18:30:23 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Feb 2021 18:30:23 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1612377023; b=gAjX6zMlp5XyngAdlipY+u/fDURPvYoCsNAWKKyw+oJOeae7KyFJpmFLj75GhlZ2YdWmRuR5NW 12rplikC4mSSDIXltmEciEPGuz3s78roYRxFs8YPk8zgeSs2cwAUqZSurGn99C1uzwLt6jnu+i yZTdwtdFiEh7RwegyI+B1l+ZzmqmjFBll23arr5KuXajrOD79Bd0F2YtOEv229UR/HRimZ1ijV rZLWZD1WRoIdIuarIdr6QiQ+DY7N36oGwGoYQIc81Irr7VFsEOTWgYfZkkbNrHvQlBppcvNuQw idjyxzoPcU+PVfyM2E+OyIsLLJNvuqRpowh6+khw8gb79Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (so254-31.mailgun.net) smtp.remote-ip=198.61.254.31; dkim=pass header.d=klanderman.net header.s=mg header.a=rsa-sha256; dmarc=none header.from=klanderman.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1612377023; bh=dCGLRC0n43jY3/q+UA5jpVAHoLf/mSz01HQBQ0sEV8Q=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:References:Message-ID:In-Reply-To: Date:Reply-To:Subject:To:From:DKIM-Signature:DKIM-Signature; b=x/vxgSSr/4hek2vqEZfVDTTX01TtkIftTGCuTqhArOZEkgPniNJha7pqwZdweA8ClHM3NRUtMc 2uZVdrOsuM0nNgyWo/pdcqdGtPFMb31KNyv6/+m/GtmzXozkNa7j3G2sAPY2AqeZ0YvB832fG3 aBW3N8XcQbGrOCbhLOdy8X+i1uFsjge0sxITMwqEv+QxnCNu65b0J+3j9x9bSzGZ0UVEGHVbyB w73aKtrk3iIk1kxcLf5YeYtJhlPJBuil/51mgnEWgMyQ9AlzlWM2AaMfJY5H/AcQt17N3Mjlob H8wip9Z5mVVvZGIABxNojC2GoagJOWGD/L5vcNILiMt+bw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:MIME-Version:References: Message-ID:In-Reply-To:Date:Reply-To:Subject:To:From:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=B95cHhUq20Ctf4B/Zx+qwBTTn6Mbol2aEzN0M+7v9qk=; b=mmGW02Y5ckr9BSq4tHNUAGgct/ Gw6BLLE/rmrF4J0/Bg91Hqq3uog9MAtjpKGRfnX7g8vgWA4hUZXyHO7wC3TF2brPmpIPSphCCRDam vC58Mux+quHvi9ginXyfclNuko97gnFyROBGnIL1CkfehTqzckN1mjD5o/ffaZy3CQWPFfUFTrBEz FoLh6rFzJPCTeoSxp8ol0xvfDbGqxgP3f7cV57LHrKDL3hoQtIj12S9pFgQBo6gzeLSMC7BEklJmu M6tmvgKa7/zEC9DiJ6ERNcOWfDIi1qMznE4gW6hT02Sd0OYw+7MVEDdo7mUlbgr0Xkq/EamfFd3mw 0F9ksyfA==; Received: from authenticated user by zero.zsh.org with local id 1l7Muz-0004jC-6k; Wed, 03 Feb 2021 18:30:21 +0000 Authentication-Results: zsh.org; iprev=pass (so254-31.mailgun.net) smtp.remote-ip=198.61.254.31; dkim=pass header.d=klanderman.net header.s=mg header.a=rsa-sha256; dmarc=none header.from=klanderman.net; arc=none Received: from so254-31.mailgun.net ([198.61.254.31]:34722) by zero.zsh.org with utf8esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1l7Muk-0004aT-8F; Wed, 03 Feb 2021 18:30:07 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=klanderman.net; q=dns/txt; s=mg; t=1612377005; h=Content-Type: MIME-Version: References: Message-ID: In-Reply-To: Date: Reply-To: Subject: To: From: Sender; bh=B95cHhUq20Ctf4B/Zx+qwBTTn6Mbol2aEzN0M+7v9qk=; b=SBVvLumSQe4VkFbClEozGwKp4EE07f3bQy5d4XJdAOPaqMh/jAIvnY4UXqWXl0Uef1xnwIao Ys5bGT/Tl33rntNt5/bILDkexWN+zuoBV2BzYtiBcy/qJw/dAFyi2fHNz7ISSTLv7sKmEpFQ CHwaOWs8d7ajNNQxfErkeV3u9OI= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyIwZjNkNyIsICJ6c2gtd29ya2Vyc0B6c2gub3JnIiwgIjk3ZGJkOCJd Received: from smtp2.klanderman.net (smtp2.klanderman.net [142.93.10.110]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 601aebab87f205364e9ddde1 (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Wed, 03 Feb 2021 18:30:03 GMT Received: from lwm.klanderman.net (pool-72-93-77-73.bstnma.fios.verizon.net [72.93.77.73]) by smtp2.klanderman.net (Postfix) with ESMTPSA id 0318F415EC; Wed, 3 Feb 2021 13:30:02 -0500 (EST) Received: by lwm.klanderman.net (Postfix, from userid 1000) id C773D29E27E9; Wed, 3 Feb 2021 13:30:01 -0500 (EST) From: Greg Klanderman To: zsh-workers@zsh.org Subject: Re: pattern matching, when the pattern is a parameter expansion Reply-To: Greg Klanderman Date: Wed, 03 Feb 2021 13:30:01 -0500 In-Reply-To: <159533057.3538925.1612368232803@mail2.virginmedia.com> (Peter Stephenson's message of "Wed, 3 Feb 2021 16:03:52 +0000 (GMT)") Message-ID: <87eehx3sye.fsf@lwm.klanderman.net> User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.24 (linux) References: <24602.50825.244206.559048@lwm.klanderman.net> <159533057.3538925.1612368232803@mail2.virginmedia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Seq: 47908 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: >>>>> On February 3, 2021 Peter Stephenson wrote: >> On 03 February 2021 at 15:51 Greg Klanderman wrote: >> % x='t*' >> % [[ two == $x ]] && echo yes || echo no >> no >> % echo "${(@)z:#$x}" >> one two three >> % echo "${z[(i)$x]}" >> 2 >> >> I would have actually expected to match in the first two cases as >> well; is this behavior of using plain string matching when the pattern >> is a parameter expected documented? > To cut a long story short: the third case is actually the odd one out. > Subscripts always treat the argument as a pattern --- the basic doc > for that is the under the "r" subscript flag, to which "i" refers. Ahh now I see it.. I had read the doc under 'r' and 'i', but the note which describes this is under 'R', and I didn't continue reading that one after the first sentence "Like 'r' but gives the last match". I should know after ~25 years to read everything anywhere nearby for all the additional nuggets... > (I find this somewhat inconvenient as it makes subscript arguments > hard to quote.) But you can just use the 'e' flag, right? > Otherwise, substituted pattern characters are not active by default: > see the GLOB_SUBST option. You can turn this on with a "~" after > the "$", see the description of ${~spec} in the zshexpn manual. Thanks for pointing that out.. another hidden nugget! I wouldn't have guessed the globbing option would turn that on, but of course it makes sense once you know.. I just found 'jobs -Z' yesterday; never in a million years would I have guessed that functionality would be associated with 'jobs' but found it reading the source code to determine how hard it would be to add just such a feature! Greg