It does have sense to match shortest and anchor to #%, it simply moves the "weight" on the right side of the pattern, i.e. "ABC" == (?)* vs ABC == *(?) (not very correct, but shows the thought). On Thu, 2 Feb 2023 at 10:32, Mikael Magnusson wrote: > On 2/2/23, Sebastian Gniazdowski wrote: > > Could the bug be fixed? It already makes #% pretty much unusable for a > > backward compatible software, yet in say 4 years this would be changed, > if > > the bug would be fixed today > > Why would you use (S) (shortest possible match) with #% (match the > entire string)? It will obviously never have a useful effect other > than doing nothing. > > That said, compgetmatch() does this, which is probably your problem > (it gives no real motivation for why it does this) > /* > * Search is anchored to the end of the string if we want to match > * it all, or if we are matching at the end of the string and not > * using substrings. > */ > if ((*flp & SUB_ALL) || ((*flp & SUB_END) && !(*flp & SUB_SUBSTR))) > patflags &= ~PAT_NOANCH; > > > -- > Mikael Magnusson > -- Best regards, Sebastian Gniazdowski