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

Re: Why approximate pattern doesn't match?



On 10 May 2016 at 05:56, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On May 9, 10:11pm, Sebastian Gniazdowski wrote:
> } Subject: Re: Why approximate pattern doesn't match?
> }
> } Hello again,
> } it appears that the approximate matching works only for first word in
> } the *~^* sequence:
> }
> } a=( "git push" )
> } pattern1='git*~^*pash*'
>
> I read that as: git followed by anything, except NOT matching (~)
> anything NOT containing "pash".  Who came up with that double-negative?

It was Mikael

> } Any solution?
>
> It doesn't seem so.
>
>         /*
>          * By default, approximations are turned off in exclusions:
>          * we need to do this here as otherwise the code compiling
>          * the exclusion doesn't know if the flags have really
>          * changed if the error count gets restored.
>          */
>
> So you don't get approximate non-matching, only approximate matching.

Too bad.. I was quite optimistic that this is: if there is another
matching run for consecutive ~^ block, then maybe some approximate
matching flag is just lost in the process, and the fix will be easy :(
What does above message mean, maybe it's 'just' "this is difficult as
we have only one error count" ?

> You can possibly refactor it this way:
>
>     a=( "git push" )
>     pat1='git*'
>     pat2='*pash*'
>     echo ${(@M)${(@M)a:#(#ia2)$~pat1}:#(#ia2)$~pat2}

I get input from user, multiple space separated words

Best regards,
Sebastian Gniazdowski



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