zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: case insensitive string match
Date: Thu, 03 Jan 2013 12:08:31 +0000	[thread overview]
Message-ID: <20130103120831.3f78bfa3@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CACQNQ9PATnMwKrr5+kdArBeypf4C614O7GFyg0ve1oX0SkTFzw@mail.gmail.com>

On Thu, 03 Jan 2013 16:03:56 +0530
rahul <rahul2012@gmail.com> wrote:
> I've 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.
 

Make sure the extendedglob option is on:

                 setopt extendedglob

and use

                 matched=(${(M)array:#(#i)*$patt*})

> I also dont suppose approximate matching can be used here (that's
> only for filename globbing, right?)

That should work fine; apart from glob qualifiers, which can't be used
with patterns whatever effect they have, about the only things limited
to filename globbing are things that really only apply to files.

pws


  reply	other threads:[~2013-01-03 12:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03 10:33 rahul
2013-01-03 12:08 ` Peter Stephenson [this message]
     [not found] ` <87zk0qzg1u.fsf@ft.bewatermyfriend.org>
     [not found]   ` <CACQNQ9P6c=hhD=X-Ur_mx+0LOknpezHsLwfz0UB9nK2hUQbpEw@mail.gmail.com>
2013-01-03 12:10     ` Frank Terbeck
     [not found]       ` <CACQNQ9MUbO0n9kuKGiW5DSYrL12-jaCPvkJiRAPNa_=MNg=HNQ@mail.gmail.com>
2013-01-03 12:43         ` Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130103120831.3f78bfa3@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).