httpd-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Bowen <>
Subject Re: Regular Expressions
Date Thu, 23 Aug 2001 03:15:12 GMT
On Thu, 23 Aug 2001, Thomas Eibner wrote:

> On Wed, Aug 22, 2001 at 10:59:27PM -0400, Rich Bowen wrote:
> > On Wed, 22 Aug 2001, Rich Bowen wrote:
> >
> > > Is there any treatment, anywhere in the Apache documentation, of what
> > > flavor of regular expressions are supported by Apache directives? I
> > > can't find it, but perhaps I'm just overlooking it, and will find it
> > > as soon as I send this.
> >
> > OK, so immediately after I sent this, I found the following in
> > mod_include.html:
> >
> > Regular expressions have the same syntax as those found in the Unix
> > egrep command.
> >
> > This is, as far as I can find so far, the only specific explanation of
> > what regex syntax Apache supports.
> >
> > FAQ-B states that "We implement a simple subset of Perl's regex
> > support" which is pretty darned vague.
> >
> > man egrep has a really good regex explanation. The only question I'm
> > left with is how to get it to do case-insensitive pattern matching,
> > since egrep does this with a command line switch (-i) rather than in
> > the regex itself.
> I take it /i doesn't work, right? (Which of course is what you'd use in
> perl)

No, the / character does not have special meaning in these regular
expressions. More specifically, there is no delimiter, as there is in
Perl. You just have a string, and that is the regex. Perl has a
character that indicates the start and end of the pattern. While this
is traditionally / it can be anything. But, since there is no such
character used, you can't put switches like Perl's /i or /s or
whatever on the end after the closing delimiter.

egrep is the same way (same as apache that is) in that you just
provide a string

egrep "patt?[eu]rn"

The quotes are optional if the pattern does not contain any special

Who can say where the road goes
Where the day flows
Only time
 --Pilgrim (Enya - A Day Without Rain)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message