Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Update the description of S flag in the completion



wt., 3 gru 2019, 10:43 użytkownik Peter Stephenson <p.stephenson@xxxxxxxxxxx>
napisał:

> On Tue, 2019-12-03 at 06:16 +0100, Sebastian Gniazdowski wrote:
> > On Mon, 2 Dec 2019 at 01:46, Sebastian Gniazdowski
> > <sgniazdowski@xxxxxxxxx> wrote:
> > >
> > >
> > > On that occasion, isn't this a bug?:
> > >
> > > ❯ str="ab##c#d"; print ${(S)str##\#}
> > > ab#c#d
> > > ❯ str="ab##c#d"; print ${(S)str##\##}
> > > ab##c#d
> > >
> > > Why no match at all in the second case?
> > Any update on this? It would be good that the rarely-used flags are
> reliable.
> >
>
> You've got an expression which can match an empty string which you're
> also telling to match a substring so it can match an empty string
> anywhere.  The order in which it tries to match will be crucial so this
> is not a useful thing to attempt.  What are you actually trying to do?
>

I was expecting that it'll do a greedy match. Turns out, as Oliver writes,
that there's something like "nonexhaustive" greedy match which seems to
work like (|\###) so this pretty much explains it. I wasn't doing anything
particular, just testing the flags before updating the description.


Messages sorted by: Reverse Date, Date, Thread, Author