Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: case insensitive string match
- X-seq: zsh-users 17531
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: rahul <rahul2012@xxxxxxxxx>
- Subject: Re: case insensitive string match
- Date: Thu, 03 Jan 2013 13:43:25 +0100
- Cc: zsh-users@xxxxxxx
- In-reply-to: <CACQNQ9MUbO0n9kuKGiW5DSYrL12-jaCPvkJiRAPNa_=MNg=HNQ@mail.gmail.com> (rahul's message of "Thu, 3 Jan 2013 18:00:04 +0530")
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CACQNQ9PATnMwKrr5+kdArBeypf4C614O7GFyg0ve1oX0SkTFzw@mail.gmail.com> <87zk0qzg1u.fsf@ft.bewatermyfriend.org> <CACQNQ9P6c=hhD=X-Ur_mx+0LOknpezHsLwfz0UB9nK2hUQbpEw@mail.gmail.com> <87txqyzcub.fsf@ft.bewatermyfriend.org> <CACQNQ9MUbO0n9kuKGiW5DSYrL12-jaCPvkJiRAPNa_=MNg=HNQ@mail.gmail.com>
rahul wrote:
>> >> Thanks a lot. I think you meant:
>> >
>> > % print -l ${(M)things:#(#i)*foo*}
>>
>> Actually, I didn't. The position of the (#i) determines where the
>> case-insensitivity starts. `*' matches everything anyway, so making it
>> case-insensitive does not add much.
>>
>> > When i typed in what you wrote I got a "zsh bad pattern"
>>
>> Works here, maybe you're missing "setopt extended_glob"?
>>
>>
>> I still get a bad pattern. I am on the latest zsh (homebrew on OSX). I
> added an entry called FOO and it comes up in the match.
>
> setopt extended_glob
>
> print -l ${(M)things:#*(#i)foo*}
> zsh: bad pattern: *(#i)foo*
>
> print -l ${(M)things:#(#i)*foo*}
> foo
> bfoor
> FOO
>
> echo $ZSH_VERSION
> 5.0.2
Weird, here both work. From zsh -f (which starts a shell without setup
files):
[snip]
zsh% setopt extended_glob
zsh% things=( foo bar bfoor thing FOO other frob )
zsh% print -l ${(M)things:#(#i)*foo*}
foo
bfoor
FOO
zsh% print -l ${(M)things:#*(#i)foo*}
foo
bfoor
FOO
[snap]
Are you maybe setting the `kshglob' option? Does it work if you do:
% setopt no_ksh_glob
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
Messages sorted by:
Reverse Date,
Date,
Thread,
Author