From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id d26cf2c0 for ; Fri, 27 Dec 2019 04:55:08 +0000 (UTC) Received: (qmail 19815 invoked by alias); 27 Dec 2019 04:54:59 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45147 Received: (qmail 29171 invoked by uid 1010); 27 Dec 2019 04:54:59 -0000 X-Qmail-Scanner-Diagnostics: from mail-vs1-f45.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25670. spamassassin: 3.4.2. Clear:RC:0(209.85.217.45):SA:0(-2.0/5.0):. Processed in 1.371851 secs); 27 Dec 2019 04:54:59 -0000 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.45 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Dhxlb9bLlB+Q52Vax4N7r0kQXCq1nO6ZjvhOZyIyepg=; b=svsm0TixjD5vy4xRhOM2GqsxCYgGhSbigwKJJgynApw7vCnQlYyJSgITJNu5NJNEQ6 MppqYOWklM7u/MVJuBKjSFpmCIYirOjxC77o1oG+yKhog+ySf0zujkNKvV53Nrq2fqoT X479nR2L7qwsN0ztNTThbWFx8BLsObs3OrmSMQwlpUBhnMu3v80inyzGk2TUtXn5di5A R2miWajGn35/gknwvL4KBGM7qD2bj8ZCSbG38m2CJLv9N3pKMTW4n+5nAO2vv3oVj4Q+ J3xyuh8SErwYHoAKZ0PL1q3hK5K/V7Xxv0D4JzgBKIbg1Z23AjTXwyS+OMf7Dm0j5rQo Pz7g== X-Gm-Message-State: APjAAAXbyPTowtsZDtvmp9jTWKoO61DfxzAiu3F4lxw1HqtvGa6vPhL6 HLmuT9csnRod0RI48qrnXlsi+oghNhaZOJ/vOhc= X-Google-Smtp-Source: APXvYqyxUVn9TO7MMGeS1tpTiQbzlX/vWr/P7jFlW9lwTIfYe5LzfWnBjS3w90okOs/c9uPi3aLN1i778GBBOqO93M4= X-Received: by 2002:a67:e24f:: with SMTP id w15mr25186214vse.113.1577422463517; Thu, 26 Dec 2019 20:54:23 -0800 (PST) MIME-Version: 1.0 References: <1a130b2e-5824-4b7a-8510-2b1d0b3fdac5@www.fastmail.com> In-Reply-To: From: Sebastian Gniazdowski Date: Fri, 27 Dec 2019 05:54:12 +0100 Message-ID: Subject: Re: [Bug] S-flag imposes non-greedy match where it shouldn't To: Daniel Shahaf Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable The trick is not right. I'll try to update it or otherwise change the description. On Thu, 26 Dec 2019 at 19:35, Sebastian Gniazdowski wrote: > > I've attached the extended description. It includes a trick to > work-around the unintuitive behavior of S. It looks as follows: > > http://psprint.blinkenshell.org/S_flag.png > > I think that the way the S flag works is a bit of an inconsistency, > Because ${str%%X##**} would not stop at the first from the right > match, it would try other matches starting from the right and go on up > to the final first from the left X. I think that (S) shouldn't change > this, but on the other hand should ${(S)str%%X##} match the first > three X? Rather not, as it would resemble ## then... Intuitively, > however, it should match all the three right X. > > On Thu, 19 Dec 2019 at 16:30, Daniel Shahaf wrot= e: > > > > Sebastian Gniazdowski wrote on Wed, 18 Dec 2019 20:44 +00:00: > > > Or rather not a bug=E2=80=A6 It seems that it's the result of how % s= earches > > > the substrings from the end =E2=80=93 it stops at the first match, i.= e.: after > > > finding a first X from the right. > > > > Could we improve the documentation of (S), then? > > > > -- > Sebastian Gniazdowski > News: https://twitter.com/ZdharmaI > IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin > Blog: http://zdharma.org --=20 Sebastian Gniazdowski News: https://twitter.com/ZdharmaI IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin Blog: http://zdharma.org