From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28551 invoked by alias); 2 Jul 2013 00:38:20 -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: 17844 Received: (qmail 4570 invoked from network); 2 Jul 2013 00:38:14 -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=-4.2 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at skepticism.us does not designate permitted sender hosts) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=s/1oFTSXSrHQY4TboQf955I9KrYDh1WA9pqAD3s8n14=; b=YXA1TCaj/gCRSc1kOBX/5xII0q8fEDpzUKyfZnKJVGfwCZiYkoKnx+6cxsacFhrONE M6cafJcGhhb5JJUqMXTAhXIicd/iybRRNop3IO6Kn1yYmWYqyq9vj4XOlQCNbObfwLFJ v7a7d05YjogAzL2iyEkEfWQgkbdKS90bjRgUo0TKJgkuDMduq3iOKSVXoD3XE7GYThVv VHKRVBtiwfsFFknnxy7+ZWEMo53Y2scaWHP/+ocfeZYMHMWWr+eu4SlI1OrmZvg0MWYD znq3ox2ePabB59yqngokNN+Gsod+PhAK9kwBgSp8dozmsKfYRicpqPUrZguZoNyHJCkW MjzA== X-Received: by 10.66.154.98 with SMTP id vn2mr6160169pab.91.1372725490669; Mon, 01 Jul 2013 17:38:10 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.66.154.98 with SMTP id vn2mr6160162pab.91.1372725490568; Mon, 01 Jul 2013 17:38:10 -0700 (PDT) In-Reply-To: <8B5FCBBB-DF52-43E1-8924-AAE08263D76F@goldweb.com.au> References: <8B5FCBBB-DF52-43E1-8924-AAE08263D76F@goldweb.com.au> Date: Mon, 1 Jul 2013 17:38:10 -0700 Message-ID: Subject: Re: input foo, output '[F|f][O|o][O|o]'? From: Kurtis Rader To: Alex Satrapa Cc: TJ Luoma , Zsh-Users List Content-Type: multipart/alternative; boundary=047d7b6d90823d67f004e07c8f64 X-Gm-Message-State: ALoCoQnaKfBTluz9je+SotQz9PwGwsVTIFQTQoXAXx+FHQiL9oPtWQvgUWB7yFy1pSB58syqRNfgVn5cT70YGl/5fM/5fVQUUvHtCBZvrpSQwoaifeN3cmUe7LO6LJe5u1kC63Hf4xttd2a00+VK+ODPiWHHljrjPw== --047d7b6d90823d67f004e07c8f64 Content-Type: text/plain; charset=UTF-8 +1 Alex's recommendation. The optimal answer depends on the capabilities of the regex engine you're targeting. In zsh, for example, you can use the #i modifier to make globs case insensitive. There's also the zsh/pcre module which provides Perl compatible regex support including case insensitive matches. In short, for any reasonable regex implementation there is no need to resort to something as clumsy as what you propose. Keep in mind to that for anything other than ASCII this is impossible, for all practical purposes, to implement correctly using the strategy you had in mind. On Mon, Jul 1, 2013 at 4:51 PM, Alex Satrapa wrote: > Since the topic is Regular Expressions, I will take the opportunity to > recommend the O'Reilly book, "Mastering Regular Expressions" by Jeffrey > Freidl. Even if you only work through the first few chapters (it provides > examples for you to play with and learn), it will be worth the investment. > > I am a very happy "student" (disciple, even) of Jeffrey Freidl's writing, > and I have many O'Reilly books in my library. > > Alex Satrapa > > On 02/07/2013, at 3:59, "TJ Luoma" wrote: > > > > > Before I reinvent the wheel, I thought I'd ask if someone already had > (or knew of) a way to take a string of characters and output a 'case > insensitive' regex version. > > > > For example, if I input 'CrashPlan' I'd want to get out > [C|c][R|r][A|a][S|s][H|h][P|p][L|l][A|a][N|n] > > > > (Input will usually be ASCII letters, with an occasional number and > perhaps the occasional '-' or '_' but doesn't need to handle anything more > complex than that.) > > > > I tried Google but found it pretty impossible to make a good query for > something like this. > > > > TjL > -- Kurtis Rader Caretake of the exceptional canines Junior and Chino --047d7b6d90823d67f004e07c8f64--