zsh-users
 help / color / mirror / code / Atom feed
From: Kurtis Rader <krader@skepticism.us>
To: Alex Satrapa <grail@goldweb.com.au>
Cc: TJ Luoma <luomat@gmail.com>, Zsh-Users List <zsh-users@zsh.org>
Subject: Re: input foo, output '[F|f][O|o][O|o]'?
Date: Mon, 1 Jul 2013 17:38:10 -0700	[thread overview]
Message-ID: <CABx2=D_1c87LyrMMiqf-J3xEZW=1KQGBwbqPxhbzRpMy9e3Zzw@mail.gmail.com> (raw)
In-Reply-To: <8B5FCBBB-DF52-43E1-8924-AAE08263D76F@goldweb.com.au>

[-- Attachment #1: Type: text/plain, Size: 1829 bytes --]

+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 <grail@goldweb.com.au> 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" <luomat@gmail.com> 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

  reply	other threads:[~2013-07-02  0:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 17:59 TJ Luoma
2013-07-01 18:44 ` ZyX
2013-07-02  0:58   ` TJ Luoma
2013-07-02  1:30     ` Lawrence Velázquez
2013-07-02  1:53     ` Benjamin R. Haskell
2013-07-02  4:24       ` TJ Luoma
2013-07-02  3:51     ` ZyX
2013-07-02  4:00       ` ZyX
2013-07-02 23:24         ` Phil Pennock
2013-07-01 19:37 ` Phil Pennock
2013-07-02  0:24   ` TJ Luoma
2013-07-01 23:51 ` Alex Satrapa
2013-07-02  0:38   ` Kurtis Rader [this message]
2013-07-02  1:11     ` TJ Luoma

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='CABx2=D_1c87LyrMMiqf-J3xEZW=1KQGBwbqPxhbzRpMy9e3Zzw@mail.gmail.com' \
    --to=krader@skepticism.us \
    --cc=grail@goldweb.com.au \
    --cc=luomat@gmail.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).