Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ 'abcde' =~ (#i)Bcd ]]
- X-seq: zsh-users 28327
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: [[ 'abcde' =~ (#i)Bcd ]]
- Date: Mon, 7 Nov 2022 13:47:11 -0800
- Archived-at: <https://zsh.org/users/28327>
- In-reply-to: <CAN=4vMoJNYik=AGE4G201Qa7K_qDMTJN91xEb_thxc5i8vpwCw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <9bc02014-76ca-b2c0-5f7c-284b90884225@eastlink.ca> <CAN=4vMoJNYik=AGE4G201Qa7K_qDMTJN91xEb_thxc5i8vpwCw@mail.gmail.com>
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