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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13718 invoked from network); 6 Feb 2023 17:18:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Feb 2023 17:18:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1675703924; b=UoUjPaH5haogZBDxq7R6NxWSni0kljdYbo8oM9iYf04c+PWftxBeA/e6W98kz61dGOiCinG8tn WQwOSfsl69Dvs2ewfE0+SOFqf0XhncLyFQa8KDt64ZZvnzeVr+Pt4bpro1n4JQxhuvzNZFvXeP sj56LKTK1Mvb+R1aXDtuKBzaSXXcb3N5DvZD6Dou+jnZ1DdB2/Mv6TLprkCyMDdj8hLf55Gcqj KY0t1FXu371pHHpxEm601aW1U/UeorQ++i7L/di6B9UUxTj4WTEzRx0rjJ9epPLC+A7HyVs3D8 HT1oQJaK92vVCQIFPoYOJj38suADg6tbPxxkLlYZGigKNQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f49.google.com) smtp.remote-ip=209.85.218.49; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1675703924; bh=IWzXWivcNCDJgCFGM0SM21ZHrolszvZipwmF6c3FfX8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Y6gttG3OPeK+THDzk1kqrXzhg5bWXaVggOFmyRaBEPygLryDMrTqZnNGjMNgLoqHW7OdKE3Zwo pA6COE3IzfwI16v6vdqUBmT2j6FxXnLtLibFNvjbWonuL9WVSG9TJS/hjJFW3PTHS9E3oHxXhr ONt3D3fHM88+FsDSOl5fVp5zFhBJ4JHO0W14SRl+7UZcxWt5peHwKRmQPIONgcxnJ754AU2pRz HcMP6Ta7/ZNe0lYohJMF9f255zI+w6L8ZtKhnTp9IR69yyiZik8uYnLPH1QP11HQks+rS/34tI 26Q2y6JUIEglWqoaYo0H7MGpoYKmmpCR7Q8Pdvrsipn3ZQ==; 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-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=saDm4gRZ+UXeTP+nuOD+rT7Uv6fspFRrgpTgCo46kmY=; b=WuW6rSE4Cv61lrip0e4MIS8PIf Zzj/lnrAYukDc1IQAfm1jOo83bXTIekN/4E0W1Zrcgjm73FrW1ORByZztKTJphO+9vTUKpnCib65o XPjLs52eEeUp58z58586zII9r+aMVRLxLOuBgdpJTpdtC6ACUb3Tbe5IATrkcgv7kuhiROVTvPkOl JXUsBpWxQu2QESdaN8LhymJ8Z7+nDEZS1XRAJQx8BvSiLRMHcQIXcjfGTA8xCC/mmF1hkikhTwQO8 9mOxeQiYzMcDmcE86/+R+/gPJH9nVr/yVOcAD0d+PGPPuIOoQHG/31AqHHRVsLcjISRordIok1uFo Fpbdooew==; Received: by zero.zsh.org with local id 1pP58c-000DNb-LV; Mon, 06 Feb 2023 17:18:42 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f49.google.com) smtp.remote-ip=209.85.218.49; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f49.google.com ([209.85.218.49]:40618) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pP584-000D3T-Kw; Mon, 06 Feb 2023 17:18:09 +0000 Received: by mail-ej1-f49.google.com with SMTP id hr39so6617482ejc.7 for ; Mon, 06 Feb 2023 09:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=saDm4gRZ+UXeTP+nuOD+rT7Uv6fspFRrgpTgCo46kmY=; b=JTyITxnsYlJq2d1Pno3l9+83Cd7kSoyNegUVhAClpx0IFUy4K+B/oAmKVEz/WFJtkQ AvEeH4DLGinl3FvTvcdTkY+FCUC8MtrmTN8otw/G9jvNhPlXX3xoE77SvJSPRNiFjd/f 8Nt6/2WGp+YJzXgI2n1O5wXWQdpktbMKS6ee06UX3oDMNxSV6H5BVESt8lLO16ObLhZf 81f3CpIlU3zpRSzmQ24RQKgauZdBxAbD9pGUVpxvRQkckp+9Wsj9LuVQYzmpe8qJ2VQZ WH3Mn8tniddjb2KSkT1D8fpqxbAvo1iIEXdxv5Lx2sWit7o0Z3CB7MJckRdSEeO3Q9PY zugQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=saDm4gRZ+UXeTP+nuOD+rT7Uv6fspFRrgpTgCo46kmY=; b=KPVAO8DNNceg51ZGcdQjPDROI1qljCHwt2Gw42PAwMMlmJk4YyfiyKORvwBcuPMGf6 ZU0mEzeYQ5cY7lrQ3WHM8NgVsefcDoEfVRmVYuNYiqEAu3owiWb3unSLXIxKre3CGxD+ n07UwMMaNIbcMFNIsb/qOortjz1LxZSgqRRAgAun5DBFBw+jed4K3PuzUEq5uvy/g1wX rPE9g7Hnn2tUzCs+3P7kt6y6rnijKrFTj0bF94fxvX8nw1I6BltW7V6IsCiSmwb976WI ey0jKoIg8+HlWSb6H1eZQR7hnRwKgSDQtqdMNMRFbBbldsZpj7aZ+yEZmcmhKCWthylv snfQ== X-Gm-Message-State: AO0yUKX6Yhf5bSRksDcWzKRS+H5HB5whjtZjuDaga4j1KUmmEk3YZUZ6 vh4Wm/T7TPsTfoYGR1+hw7fgwqqDsiMax/IzmuTn1CDGyKwdSniD X-Google-Smtp-Source: AK7set+/A/p0JlOmeY4f6Gg3LYvtdyNyWFRbbCl5ZNlTee7wgXt5bu8cmm1zT4qAx6AuCGdn+ItkT6POCbxqKLbcL1M= X-Received: by 2002:a17:906:4dc7:b0:877:e1ef:e49a with SMTP id f7-20020a1709064dc700b00877e1efe49amr19661ejw.147.1675703888012; Mon, 06 Feb 2023 09:18:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Mon, 6 Feb 2023 09:17:56 -0800 Message-ID: Subject: Re: #% anchoring doesn't work with (S) To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 51365 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: On Thu, Feb 2, 2023 at 4:49 AM Sebastian Gniazdowski wrote: > On Thu, 2 Feb 2023 at 10:32, Mikael Magnusson wrote: >> >> Why would you use (S) (shortest possible match) with #% (match the >> entire string)? It will obviously never have a useful effect other >> than doing nothing. > > It does have sense to match shortest and anchor to #%, it simply moves the "weight" on the right side of the pattern, i.e. "ABC" == (?)* vs ABC == *(?) (not very correct, but shows the thought). Arguably then this is wrong: % sample=match % : ${(S)sample/(#b)(#s)(m*)(*)(#e)}; printf "<%s>" $match ; echo I expected . Compare without the end anchor: % : ${(S)sample/(#b)(#s)(m*)(*)}; printf "<%s>" $match ; echo In any case the behavior of PWS's patch appears to be the same. Also % : ${(S)sample/(#b)(#s)(m*)(*h)}; printf "<%s>" $match ; echo I guess it's ambiguous, but in other patterns like (this|that) we prefer the left before the right.