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

Re: Pattern bug on (a*|)~^(*b)



> On 02/08/2023 09:31 Johan Grande <nahoj@xxxxxxxxx> wrote:
> 
>  
> Le 01/08/2023 à 15:30, Peter Stephenson a écrit :
> > On 01/08/2023 14:19 Johan Grande <nahoj@xxxxxxxxx> wrote:
> >> So I'm thinking I could filter for user-provided patterns that contain
> >> '|' and don't put them in the mega-pattern but filter for them
> >> post-globbing. Does that sound like a sound solution to you?
> > 
> > Yes, I think that would be OK.  [...]
> 
> Actually, an AND can be expressed as a combination of ORs and NOTs. So I 
> can build patterns such as
> 
> ^(^(pat1)|^(pat2))
> 
> and never introduce ~. (With pat1 and pat2 arbitrary.) Basis tests show 
> it working. Can you see any issue I might run into if I implement my 
> queries like this?

That certainly shouldn't tickle this problem since the exclusions
operate locally, so the problematic string recording positions is
recreated each time.  It's probably a bit less efficient since the
exclusions do some memory management for that state record, but
if that's not causing you a problems you should be fine.

pws




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