From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8564 invoked by alias); 3 Jan 2013 12:17:10 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17529 Received: (qmail 3463 invoked from network); 3 Jan 2013 12:16:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: rahul Cc: zsh-users@zsh.org Subject: Re: case insensitive string match In-Reply-To: (rahul's message of "Thu, 3 Jan 2013 17:33:16 +0530") References: <87zk0qzg1u.fsf@ft.bewatermyfriend.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Date: Thu, 03 Jan 2013 13:10:36 +0100 Message-ID: <87txqyzcub.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain X-Df-Sender: [pbs]MDExNTM1 (Forgot the mailinglist in my first reply, readding) rahul wrote: > On Thu, Jan 3, 2013 at 4:31 PM, Frank Terbeck wrote: > >> rahul wrote: >> > been using this for doing some filtering from an array: >> > >> > matched=(${(M)array:#*$patt*}) >> > >> > Now I need to have an option of case insensitive search. Looked through >> the >> > user's guide and other sources but I don't see a flag to ignore case. Is >> > there a way without changing this to use grep. >> >> % things=( foo bar bfoor thing other frob ) >> % print -l ${(M)things:#*(#i)foo*} >> foo >> bfoor >> >> 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"? Regards, Frank