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=-4.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25199 invoked from network); 20 Sep 2022 07:16:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 20 Sep 2022 07:16:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1663658171; b=NFvQ8eus3zm7Ucx5EziYu2bGeQtC+Yr+3k0uW2kgzqEs8mUX6+T6hKmK+yBichJT7iNSo0yb1p 2Tu1q8pri6Z+Rag4iSYUz0mxdq4IA6222Rqe9hXC6RMBVvzMj2M6eqhM8pAK/EiG7Z9PbpnV3I ABxeXx06HiRrAMN1u1g3xq0kJjFmi62lsyAyfnfMQPQmUdSPJq21tf85+TZRqx0Bsp3bAEyR76 gSetg5LG85DfgZn35puMpPB0elAVBKcq3aThnq/ZI6ViQ01X+h7V0nomK4sJceBsCU+WRDcxrr KR10vk3EARajN1WR7tCu9I/Qk6AHzCr8/OBy2weUmk1Itw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (p3plsmtp26-04-2.prod.phx3.secureserver.net) smtp.remote-ip=216.69.139.30; dmarc=none header.from=rayninfo.co.uk; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1663658171; bh=1ufwpmsnxOQF7lnLovQm9x6URq55e+eS2H0xodB/hzw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=QZ9Q8b6bLkegRNrEJijTVm4ensP3SNqwTQmNPT5msVg+L4VQIjc7ZLty7836khLtn6zI+6uNqB 8sIg6KEkXXGi29CfyrXjWHgx/nNnryJuMXjgjr9lCfPPMRWIB6dYUmuylcFv8j4PIIWQxH567G iqeUo6WvKHF0MJhcRyGdOb0skUa51+p9S3P+KHJRAZaeZ3rNDFzpcz6Orudvyun3OUJmksW2wD HnCY+P5LZR2V0dCxBPqn7Tj/tKH51/2ZPGr5G2PPYoeVg6qgMWc6wnus00Px8i5dO+D+tWWT2v yzWlLIZPj6Hf1f2jOAqJD2qugQ16KDG+wwY7EvNQX4T5kQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=IMbsLxdDjbmqtinUTMtr1hYmWFq1qaba4C2+YBG1hLg=; b=qsGeu6qp4imIjN3BSWKc4Vd3id kWb3Ntq1LqZ5rG4MHF/689miCdxNKDBqOe9+T8fSskKpE4kTgw3qk3TRi8nmfj7BHMhwRa7VnfK+0 S25kWisfVO/ojMNY3nClp9qUOMKB78gFkx5vwQvvPfQTiUcLkIESiJKB5b+N3wkGbUaPH7bj9rurZ bDrz5QEKhQqn7dzBmOa28n8Qvo+gqASWIZY21SaNrGtI36+COVhTVZtFYK+ZyhLjqig2SAlfEwsSK h9QNBGnRgBvz7yNuSYXw1hfFrSZwkzBHW+6ABvzqAvzzslLOEk9h7MenTtNPnpqK7PB6oANi1IEhU /IyPYTIw==; Received: from authenticated user by zero.zsh.org with local id 1oaXUH-0000aJ-Ha; Tue, 20 Sep 2022 07:16:09 +0000 Authentication-Results: zsh.org; iprev=pass (p3plsmtp26-04-2.prod.phx3.secureserver.net) smtp.remote-ip=216.69.139.30; dmarc=none header.from=rayninfo.co.uk; arc=none Received: from p3plsmtp26-04-2.prod.phx3.secureserver.net ([216.69.139.30]:46024 helo=p3plwbeout26-04.prod.phx3.secureserver.net) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1oaXT3-000PYk-Db; Tue, 20 Sep 2022 07:14:54 +0000 Received: from mailex.mailcore.me ([94.136.40.145]) by :WBEOUT: with ESMTP id aXT0oXAr54YwwaXT1omSGS; Tue, 20 Sep 2022 00:14:51 -0700 X-CMAE-Analysis: v=2.4 cv=TcNTCTch c=1 sm=1 tr=0 ts=6329686b a=7e6w4QD8YWtpVJ/7+iiidw==:117 a=UNgyr3XT6yv5NrNUVILU/Q==:17 a=1HjCxttUbyEA:10 a=IkcTkHD0fZMA:10 a=xOM3xZuef0cA:10 a=22Ro6XbQAAAA:8 a=2cHwWv9QZ_9SiMFjyeEA:9 a=QEXdDO2ut3YA:10 a=p1RiBf0vZFgkX3Jmbd9N:22 X-SECURESERVER-ACCT: david@rayninfo.co.uk X-SID: aXT0oXAr54Yww Received: from [95.145.222.232] (helo=[192.168.1.231]) by smtp04.mailcore.me with esmtpa (Exim 4.94.2) (envelope-from ) id 1oaXSz-0001d0-SV for zsh-users@zsh.org; Tue, 20 Sep 2022 08:14:50 +0100 Message-ID: Date: Tue, 20 Sep 2022 08:14:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Can I test if a parameter expansion has worked Content-Language: en-US To: zsh-users@zsh.org References: <5dc8b935-f234-ca54-0ceb-50cb1da9bc29@rayninfo.co.uk> From: david rayner In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailcore-Auth: 8308408 X-Mailcore-Domain: 840527 X-123-reg-Authenticated: david@rayninfo.co.uk X-Originating-IP: 95.145.222.232 X-CMAE-Envelope: MS4xfF9bRt6aWH9MJOw2P2Jz9GdPc7FEYyngV8I2x9SUuMUuMbKC5WPod7w9ysyaKSAuVsLhq8nMgA+ZhNyTTU6ciP9q5GdXCT5kGbOEJs7EecVWOTKN0LKE VorVtekJq2zx0o3ozX5pVP6HAmGA1xGhq6NFZHD3X+lSayYjHju6a6+HCr9v0j80vGrSA+dZdrrEoA== X-Seq: 28104 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 15/09/2022 17:48, Bart Schaefer wrote: > On Thu, Sep 15, 2022 at 12:34 AM zzapper wrote: >> print ${f/%(#m).[pjg][npi]e#[gf]/_s$MATCH} >> stuff.txt # expansion has obviously left the input unchanged but can I >> test for that??? > In the general case, no, as PWS has already addressed. > > In this specific case, tho, if you "unset MATCH" before doing the > substitution, you can test $+MATCH after. > Bart Generically useful thanks (sorry late reply) f=fred.jpg print ${f/%(#m).[pjg][npi]e#[gf]/_s$MATCH} echo $+MATCH 1 zzapper