httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <sl...@commerce.ubc.ca>
Subject Re: PCRE and regex question...
Date Thu, 07 Jun 2001 21:54:00 GMT
On Thu, 7 Jun 2001, Greg Stein wrote:

> On Thu, Jun 07, 2001 at 05:01:16PM -0400, Greg Marr wrote:
> > At 04:17 PM 06/07/2001, Bill Stoddard wrote:
> > >Is there a quick way I can check a string to see if it is a regex or
> > >not?  I am looking at extending SetEnvIf to accept a regex on the
> > >'header' argument (value may already be a regex).
> >
> > The absolute easiest would be to require that the regex start and end
> > with a /.
> > SetEnvIf nonregexheader
> > SetEnvIf /regexheader/
> >
> > You could also use a regex on it:
> > /^[-A-Za-z0-9_]*$/
> > This assumes that only letters, numbers, -, and _ are allowed in
> > header names.
>
> Strictly speaking, every string is a regex. It is just that "abc" doesn't
> say a whole lot :-)
>
> I like Greg Marr's suggestion of requiring /regex/. That also helps to
> clarify things for the user who is reading .conf.
>

I'll chime in here with my usual consistency arguments:

There are MANY Apache directives that take a regex and none of them
use the /regex/ notation.  Please don't invent a new notation unless
it is really necessary.

I prefer Greg's second suggestion.  Just evaluate the input at startup to
determine whether or not it is a regex and store the answer so that you
don't waste request-time processing.

Joshua.


Mime
View raw message