zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>,
	Daniel Shahaf <d.s@daniel.shahaf.name>
Subject: Re: [PATCH] zshexpn: Expand documentation of (S) (was: Re: [Bug] S-flag imposes non-greedy match where it shouldn't)
Date: Mon, 30 Dec 2019 21:20:34 +0100	[thread overview]
Message-ID: <CAKc7PVA-G9J1sAYdEJ-6GtqQnTx3RyJP6x-jM3JEYqX6NV3Gpg@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMqyNngcWKH7TfN14Rh+5vyDJ-v8ciNiF7OHrNQG=OLvDA@mail.gmail.com>

On Mon, 30 Dec 2019 at 21:01, Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
> They do with the latest patch for (S) from Daniel:
>
> > With tt(%) or tt(%%), search for the match that starts closest to the end of
> > the string
>
> This means that ${(S)str%%X##} is going to find a match that starts
> closest to the end of the string and remove it. X## matches one or
> move X characters. We go backwards one character at a time until X##
> matches. The first match starts at str[-2] and the match is X, so X
> gets removed. This seems clear from the docs.

Ok, this does seem to capture the issue.

> I think it would be beneficial to specify that with ${(S)str##pattern}
> the first attempted match starts at str[-1] and that no attempt is
> made to check if the empty string (the ultimate shortest suffix)
> matches. I think you or someone else has recently raised this point as
> this seems inconsistent. It's surprising to me that both ${str#*} and
> ${(S)str%*} expand to $str while ${(S)str%%*} doesn't.

Also, ${str%*} doesn't expand to $str, which seems to be a bug? Is it
a different uncover of the one from users/22600?


--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

  reply	other threads:[~2019-12-30 20:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 20:41 [Bug] S-flag imposes non-greedy match where it shouldn't Sebastian Gniazdowski
2019-12-18 20:44 ` Sebastian Gniazdowski
2019-12-19 15:29   ` Daniel Shahaf
2019-12-26 18:35     ` Sebastian Gniazdowski
2019-12-27  4:54       ` Sebastian Gniazdowski
2019-12-27  5:09         ` Sebastian Gniazdowski
2019-12-27  5:29       ` Daniel Shahaf
2019-12-28 19:04         ` Sebastian Gniazdowski
2019-12-28 20:34           ` Bart Schaefer
2019-12-28 21:00           ` Daniel Shahaf
2019-12-29  0:56             ` Sebastian Gniazdowski
2019-12-29  2:05               ` Daniel Shahaf
2019-12-29  3:14                 ` Sebastian Gniazdowski
2019-12-30 18:00                   ` [PATCH] zshexpn: Expand documentation of (S) (was: Re: [Bug] S-flag imposes non-greedy match where it shouldn't) Daniel Shahaf
2019-12-30 18:11                     ` Roman Perepelitsa
     [not found]                       ` <CAKc7PVAXLpKqZvmbazZK=mvcz8T-AHJXKusut6aEjkkSLzgdbw@mail.gmail.com>
2019-12-30 20:01                         ` Roman Perepelitsa
2019-12-30 20:20                           ` Sebastian Gniazdowski [this message]
2019-12-30 21:24                             ` ${(S)%%*} doesn't match the empty string (was: Re: [PATCH] zshexpn: Expand documentation of (S) (was: Re: [Bug] S-flag imposes non-greedy match where it shouldn't)) Daniel Shahaf
2019-12-30 21:44                               ` Roman Perepelitsa
2019-12-30 22:11                                 ` Sebastian Gniazdowski
2019-12-30 22:34                               ` Peter Stephenson
2019-12-30 21:40                             ` [PATCH] zshexpn: Expand documentation of (S) (was: Re: [Bug] S-flag imposes non-greedy match where it shouldn't) Roman Perepelitsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKc7PVA-G9J1sAYdEJ-6GtqQnTx3RyJP6x-jM3JEYqX6NV3Gpg@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).