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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4437 invoked from network); 13 Sep 2022 04:20:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Sep 2022 04:20:43 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1663042843; b=CNYdZMwFpdvEcAC8BfrcdX970yuKdKlD1p2EJO0UnCz2aTsqg8om3fWeZbVVsJTApAPtLh4g+O dewC1FI84vthINML5Ih2B31MtqVf36+YihZRz/KeusPRa94Y95JVY+wJempOkvyMM9yfvsMvU2 7m7OfS+kMHTnpI2I/Mhx218inEwTybr6pF4uiVEpaRwIy9BG7Ev7TfGqsLHGqFJJjy6PaP5xxL JXAMRAHRtZkdn0zPQoqYGbkvuxiK9jB23PxzAcD1lLLCDY36PHwjQao68/tuaYlL+McUlVZz1K cn6mXNJOdY416ikm2RTSqPFrpFVAVHLNqGXBsTNH6F9Aqg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pf1-f180.google.com) smtp.remote-ip=209.85.210.180; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1663042843; bh=2ic4a81B+1xezugd19yABp0BWnrj+zdfHlQbJeIRiL0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=K442vnvXET+YOSIz47hTdau1GFq4JzpUjgqceUOLhiSvko7h8WdeFEnBTmWyIUrQbnzRDuB3+Z r22X2JX3UgJCTUYJb06gk2HbEXckxvtQwaaj18B7XMrPUNpDZUY+z56ir/68Tr++ukzY4NGDNT aCM3qYeJ9cL8rwDbebhaSqGAxCGbsgH4otT8nCJ+CR31VrvyvaUTlpoydivo2l7o3pI33TlbCZ 86S4c/wY2fOFPkr73Lo5EgYRLvecDUSDcAzO14IiWKMBIW9LZhkOz+vfPaT9zDrlpPyBvtwWd+ bHjlC3uXnST6VxVL8+PvxKx4ry/iVBJcgzopqhJUDr8jEg==; 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:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=2ic4a81B+1xezugd19yABp0BWnrj+zdfHlQbJeIRiL0=; b=I9aaC/toLkf4GbB/gNcxInCRtx dghfL0Kv+YUNPAbBf25Ls+qk2i2BvhAN/mL0Z/tRcSdrTutuW3TX/i4jqeQPp0adrXgzLHcayCHe4 q4hplDuc9i9aEA5zL0e6RsHuiLP1vx0df4zwsUB9PAViYuVawijga/s6atGLApF60nPZJjayWvjvP fwSDukujDgcoZzSwKt8BN7UNswL6gJvi+hQMIdN2Q6MIu/4EmiWrBWTN2grIrBSDbHLsNA1VfYgeU e+rG65WKfqy16+FEF3bWyHvjYGSAStjYrXLCBzlathQRE92/x7Cs/bLi0X1jPuZUKM9bq+hEdtgTZ MOSwUx3w==; Received: from authenticated user by zero.zsh.org with local id 1oXxPd-00090z-Ug; Tue, 13 Sep 2022 04:20:41 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pf1-f180.google.com) smtp.remote-ip=209.85.210.180; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pf1-f180.google.com ([209.85.210.180]:38710) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oXxOd-0008L3-QQ; Tue, 13 Sep 2022 04:19:40 +0000 Received: by mail-pf1-f180.google.com with SMTP id y127so10583053pfy.5; Mon, 12 Sep 2022 21:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=2ic4a81B+1xezugd19yABp0BWnrj+zdfHlQbJeIRiL0=; b=X1eKZL2NTYda8Y0eS6Gg+gjS+JyFZ7Dwf/2fzHGbAo7b355Qb37Z2EYbF0/alQz4W2 gBFGzwaLO9wgmm6bCcFrkQbMWtEJV1/q1wCzqD+/L0DKT+iu63O5y/grJuMFi9mCM8ZW 8Lt8K7Qmu5Jb+WTSYCXPpqXKKd7ovYbe6CwcxjYNyIpvOmKDGOWn727VqpBvAcotFVrF DDUkVIUgF3dZp6pzujKS8dAa9O/b19u856g7q+4GKic3qoegqGz2Fejs2YkhoiNYa7Zw d1KVxFuaUx1q0FLOsJ3Z8KkJtnYTmnVZTPPeXXuWCmG5DVCfnBIrmf7HZ5Jy9/Xtd8Ha zfaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=2ic4a81B+1xezugd19yABp0BWnrj+zdfHlQbJeIRiL0=; b=apXXTuMoHFipaXTBLqUBjR2l3rv2IktvrgBOuPF30J3N5a3zLb6kwmGwOk+yRi8kUe 80Elvmxv5mnA7cmL+xmT8uzfy9XLYxZH6YNK72EnKEcZ8uDYXIxe/za8xyPWPeSJjnDj LUVAX6B3x8zm335Fj1tDStMdvFIGZv6nkD+8XaQrDOuDJ+9xxf4g8KE4FaBiHVWyySqM 93kMpPr2cXy+TKEFbtgNfw6huwJ1+8vkm5oNsRmxz3DHzmgquI0jsarPVNsirsjZEvM1 tAEhHE+KCRyPOIEXaxEKozhpNqjC8+tGCS7Jl95ooguCBLzIZkJxbH9mVZGCVKWBZUyI cdcg== X-Gm-Message-State: ACgBeo3G7R4IyxjNMFVmM/43rYRxhQ2kgYneuluVtHTZvIQzIgPaNTUa yHbmAaDXX+xVxz/FkuNR2s0p3x362Nh6IDQducKwpj1DE88fdRPo X-Google-Smtp-Source: AA6agR534YivZvBuFT3K0jFHG4ewSQJBvE7cU2zKhpF6vCFfb5PFyg83Sk16EMqDa/op1ATFdm9GiT74fDNJPlbkyYA= X-Received: by 2002:a63:da4b:0:b0:439:14a8:52b with SMTP id l11-20020a63da4b000000b0043914a8052bmr5553825pgj.500.1663042777205; Mon, 12 Sep 2022 21:19:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Michele Venturi Date: Tue, 13 Sep 2022 06:19:25 +0200 Message-ID: Subject: Re: Substitute the last match of a pattern during parameters expansion. To: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000fb52da05e88751ca" X-Seq: 28064 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: --000000000000fb52da05e88751ca Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Sep 12, 2022, 08:01, Lawrence Vel=C3=A1zquez, , wrote: On Mon, Sep 12, 2022, 12:20, Michele Venturi, , wrote: > > Hello, I have a problem, can you help me? > > I would like to substitute the last match of > > a pattern during the parameters expansion: > > the string aXbXc should become aXbYc; > > I have not found a direct and general way > > of doing it, but there are some solutions=E2=80=A6 > > > I would suggest a new flag like % or $ for it. > > I wonder if the syntax ${(%)str/X/Y} is going > > to conflict with other functionalities of ZSH=E2=80=A6 > > But there is already a '%' flag... This doesn't merits a new one. > What merits a new one then? > Adding negative indexes support to the 'I' flag > would be very good but verbose in my opinion. > > Extending the 'I' flag in this way would be ideal. > How do you extend the I flag? -- https://about.me/dardo82 --000000000000fb52da05e88751ca Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Sep 12, 2022, 08:01,
Lawrence Vel=C3=A1zquez,
<larryv@zsh.org>, wrote:
=

On Mon, Sep 12, 2022, 12:20,
Michele Ven= turi,

> Hello, I have a problem, can you help me?
> I would like to substitute the last match of
> a pattern during the parameters expansion:
&g= t;
> the string aXbXc should become aXbYc;
> I have not found a direct and general way
> of doing it, but there are some solutions=E2=80=A6

> I would suggest a new flag like % or $ for it.
> I wonder if the syntax ${(%)str/X/Y} is going
> to conflict with other functionalities of ZSH=E2=80=A6

But there is already a '%' flag...
Thi= s doesn't merits a new one.

What merits a new one then?


> Adding negative indexe= s support to the 'I' flag
> would be ve= ry good but verbose in my=C2=A0opinion.

Extending the 'I' flag in this way would be ideal.
=

How do you extend= the I flag?


<= div dir=3D"auto">-- --000000000000fb52da05e88751ca--