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

Re: [[ 'abcde' =~ (#i)Bcd ]]




On 2022-11-07 13:26, Roman Perepelitsa wrote:
[[ 'abcde' =~ (#i)Bcd ]] && echo match3

(#i) only works with pattern matching.

But isn't that a pattern match?

[[ 'abcde' = (#i)ABcde ]] && echo match2

... that seems happy so it would seem that wildcards aren't required.

In this specific case it's better to use pattern matching of course:

     [[ $foo == (#i)*abc* ]] && echo match

That's what puzzles me I expect:

[[ $foo == (#i)*abc* ]] && echo match

and:

[[ $foo =~ (#i)abc ]] && echo match

... to be exactly the same. If not, why not? Actually there are several workarounds but still I'd expect that to work too.






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