zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: ZyX <kp-pav@yandex.ru>
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: Tue, 2 Jul 2013 19:24:47 -0400	[thread overview]
Message-ID: <20130702232446.GA1583@redoubt.spodhuis.org> (raw)
In-Reply-To: <497991372737643@web23e.yandex.ru>

On 2013-07-02 at 08:00 +0400, ZyX wrote:
> > > Phil Pennock's version worked great:
> > > 
> > > % foo=CrashPlan
> > > % for c in ${(s::)foo}; do print -n "[${(U)c}|${(L)c}]";done; print
> > > [C|c][R|r][A|a][S|s][H|h][P|p][L|l][A|a][N|n]

Sorry, I was in a rush and missed that this was [A|B] which should of
course be written [AB] or (A|B) if the regexp language supports the
latter.  I should have caught that, instead of answering exactly what
was asked.

> > Unless AddDescription uses different regex engine then FilesMatch
> > answer is in the first link if searching for "htaccess case
> > insensitive regex": (?i:pattern).
> 
> It seems it does use different regex engine.

AddDescription does not take a regex.  It takes a filename pattern, or
what in shell is called a Glob.

It happens that some shells use [AB] as a glob pattern too, also to
introduce a character class, and that's why it works -- Apache supports
that syntax also.

Those places in Apache that do take regexps use the PCRE engine, the one
written by Philip Hazel for Exim, and which zsh also supports with
"zmodload zsh/pcre" (or setting the option to change =~ to use it,
"setopt rematch_pcre", which will auto-load that module when you first
use =~).

So those places in Apache which want regexps, you can test with zsh to
get a decent approximation, or use the pcretest(1) tool from the PCRE
distribution to get something designed to interactively test regexps
against inputs.

If you want to settle on that syntax, also consider installing the
pcregrep tool.  It's very nice to be able to relax and just use PCRE
syntax, even though the PCRE implementation is not as efficient as the
older tools (or the newer RE2 system).

-Phil


  reply	other threads:[~2013-07-02 23:25 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 [this message]
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
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=20130702232446.GA1583@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=kp-pav@yandex.ru \
    --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).