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 13290 invoked from network); 14 Sep 2022 22:00:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Sep 2022 22:00:43 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1663192843; b=YD+ucVho9nuGOIb8pxso/nxwDCmN01oxQsHheiuKSnSGVw1bTLQrdQ6Ea96RCg/UdO6Yca9SD9 DaXEp2Vn0czB9RxEBsxV68wUOeKdYvewxGubkqBnJEiJePKwJEdW6JhzKs5rbQefn6b9GZQZa1 nH4ciiQW8ZEFpgaU5u1qIgCEVfNZd6HG1+OcQhQPS8X6t/qDTZtbsP3GYgC69RjKijTX6yXDCr Gu8KRa6UvyuI8hGci8fgwFDCmMu1FWqWSDNNNEyTacdR0yfb1qvm8UgvRmwrPEFvdu5FjX1+DD iijigbHC5Zc/83j9RfnM7Q+8aST6jnTqRfxMSwGDxDcaeQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pj1-f43.google.com) smtp.remote-ip=209.85.216.43; 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=1663192843; bh=ic0Me8cT7nm1dFZXXj8QGQm2GVtauPAAqxrOmOmAaoc=; 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=XhsBBMkgF1H2uhF3xKAtme0BaLhQYi2n0gfjM+TuLUTDqHk+JAzd5c6oNx2ZGZakmRSx2IVzNy GFOnWpJo9oXeMtCWwq+2ijnWMEGYQpkpnTdTPuRV4xGsfbcvzupgq/jbH0vntP7lSQf6C0/rsW njDcirrDIsyNvXeUl+WJorzhyyF1x5unEsTWGhkACs2jZ7o5vo1uLDhnANn581sBqFrehpfpIZ MqAfX2xVlV7jV7C7+5vl0NQgrEVEIzXg1Y8UPTqG4ZeaOIVdjFPJv+U6//8+CUA1kth1eBT7he Hx6xu+JsbcQiSrHN67kyutGyFfo1+xPGoTsxh8kSMFvE6g==; 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=ic0Me8cT7nm1dFZXXj8QGQm2GVtauPAAqxrOmOmAaoc=; b=Z5wfsB0niJvYo/m2q2+NA8kZqL eKlqDFEv+wtVHuHlqfMZ5QouU+IZ8kc2LAah7Yf4db9Q2MPoTUCmtl+gVzQjqiiDzIhoaxy5ZriEz HXcG68k0uCMK7Z24IcJWpeQbPzgaGdoZoiUKVDumNsqHdQnryqtwvEeHc0E0dAPwTcArqIk2St5P9 2koX+XFG6TvdA0vJHFa6+9wCHcub1/yl5+sopxu3W8a4OeB/B6Bb6IaGr/6Kso46agGns5ruXS7SX MdDx1FJtWnwuDW+wnFcZLUJ4XEoww5xttNkmmygQR2jRMWWJIfrDorLKQyTdPSIsv9lHV6eixPoTN 2kqDRWDg==; Received: from authenticated user by zero.zsh.org with local id 1oYaR1-0005fg-4d; Wed, 14 Sep 2022 22:00:43 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pj1-f43.google.com) smtp.remote-ip=209.85.216.43; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pj1-f43.google.com ([209.85.216.43]:41586) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1oYaQ4-0004yu-Ks; Wed, 14 Sep 2022 21:59:45 +0000 Received: by mail-pj1-f43.google.com with SMTP id q15-20020a17090a304f00b002002ac83485so15721391pjl.0 for ; Wed, 14 Sep 2022 14:59:44 -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=ic0Me8cT7nm1dFZXXj8QGQm2GVtauPAAqxrOmOmAaoc=; b=nit8hpIEX7bjtx0pGIjK2pttSVwvD/sm62iolQ4FeJRq8POI40Akf0HEbVqfLlpujJ m6/J6Nq8exKCJoEkdVH0tnmWS1GDvgwR6saufdpMdJAXRzr+BsjJ2bMfV6b/mX+p6FMn Rf7LNdtIZ9Lgfvu32t7BHlTjAf6ghRhWrXCKoVFDWOzKSVruyyARLaP4BtdJHt7gWvtS 2jooXt46afayCVPyEW6zzYyty89ewg+4/TYFwPCjcPriCmep9Ee5eulk6KoPTLlORcnX V6kAE9bJ/DaBxKzlQCyd0Qo6sOMtqd5JTSt5EtKUumFuLYqIBQq0sjBqFzKfLG5noSwp t9VA== 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=ic0Me8cT7nm1dFZXXj8QGQm2GVtauPAAqxrOmOmAaoc=; b=jV5U41vqgZgJ+jVF1CDfqjogOuAl7TOTENaoALhiiLOlLM2esC9ifaum2dJoEbfOsB dqDo7QkYnzpGk+RUPRfVZ9iT5T69MJfHr56rKFNtIdzjUYAGx+8l0YW4b4mnm6ojZcjr y8RXmaXd0X5AXiU95LdQNWKDEs2KoGjjcnO+ip+Jetgx/VjMYn8S72z7zQ8yiDSMqSil jPAgkzD8T0HGCMm9DSmdFP/mf1aXtVjX6fQAn66HP1PfYx3zELYTsHBvmsmI1PYprr+1 nY1ZysY0N4mBQQsk4XEtJ/ThcLV708OJiJN3JIYbv5KcBGYepDc/6LgN/D3ROv1l7n3H 69ug== X-Gm-Message-State: ACrzQf2lLFs/aeUV5tYDn01mN5L1T1lv4IoL+tPdAW/IhuMCW4Rf24L6 2nUicjAOpoWR8oe3ryZ2PMGABi9ZSqtlNONVerO+VhYdu1/f9fgI X-Google-Smtp-Source: AMsMyM5Go34KxyWOP4lPJvmUgvCH0HIBy4Su0RItzou9FaRPXtPRwIScuKZQyHRTQfkvQXil1Y2NdLnQ44AgDu3opIM= X-Received: by 2002:a17:903:2406:b0:174:f1c8:76bc with SMTP id e6-20020a170903240600b00174f1c876bcmr1079650plo.168.1663192783095; Wed, 14 Sep 2022 14:59:43 -0700 (PDT) MIME-Version: 1.0 References: <4844b850-2ca6-4c90-95ae-aae00dc339cf@www.fastmail.com> In-Reply-To: From: Michele Venturi Date: Wed, 14 Sep 2022 23:59:31 +0200 Message-ID: Subject: Re: Substitute the last match of a pattern during parameters expansion. To: Bart Schaefer Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000078e3105e8aa3f08" X-Seq: 28073 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: --000000000000078e3105e8aa3f08 Content-Type: text/plain; charset="UTF-8" On Wed, Sep 14, 2022, 20:56 Bart Schaefer wrote: > On Tue, Sep 13, 2022 at 8:20 PM Michele Venturi wrote: > > > > Plus you seem good at non trivial tasks if you can > > write that monstrousity.Do you know what's trivial? > Counting, to know > how many matches there are... > > Definitely keep that approach and see how much help it gets you in the future. > I'm the one helping you pointing out your weaknesses and prodding you to get better,don't get confused,ok? > There are examples of supporting negative index, > > so don't see a reason why it is so difficult to do it. > > For benefit of other readers ... > So you are basically saying that I'm right but you don't like me, so you don't want to talk to me, that is surely a grown up approach, or maybe not? Not sure about it... To implement negative indexing, it is necessary to walk to the end of the > string to count the number of occurrences, while "remembering" where each > one appears, and then backtrack to the position of the Nth-from-last match > and replace just that one. > > Those who think this is both easy and worthwhile, If you have written the code for the forward indexing, it's easy and worthwhile,otherwise not so much,no? Anyway it seems that nobody here is able to do it now, so maybe this is the wrong place to ask for such things. Are there other mailing list with more knowledgeable people on this specific subject? Maybe ZSH-workers? --000000000000078e3105e8aa3f08 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Sep 14, 2022, 20:56 Bart Schaefer <schaefer@brasslantern.com> wrote:
On Tue, Sep 13, 2022 at 8:20 PM Michele = Venturi <dardo82@gmail.com> wrote:
>
> Plus you seem good at non trivial tasks if you can
> write that monstrousity.Do you know what's trivial? > Counting,= to know how many matches there are...

Definitely keep that approach and see
how much help it gets you in the future.
=

I'm the one helping you p= ointing out your weaknesses
and prodding you to get = better,don't get confused,ok?

> There are examples of supporting negative index,
> so don't see a reason why it is so difficult to do it.

For benefit of other readers ...

So you are basically saying that I'm ri= ght but you don't
like me, so you don't want= to talk to me, that is surely a=C2=A0
grown up appr= oach, or maybe not? Not sure about it...

<= div dir=3D"auto">
To implement negative indexing, it is necessary to walk to the end of the s= tring to count the number of occurrences, while "remembering" whe= re each one appears, and then backtrack to the position of the Nth-from-las= t match and replace just that one.

Those who think this is both easy and worthwhile,
<= div dir=3D"auto">
If you have written the code f= or the forward indexing,
it's easy and worthwhil= e,otherwise not so much,no?

Anyway it seems that nobody here is able to do it now,
so maybe this is the wrong place to ask for such things.
=

Are there other mailing list = with more knowledgeable
people on this specific subj= ect? Maybe ZSH-workers?

=
--000000000000078e3105e8aa3f08--