views:

329

answers:

1

I want to be able to read the cookies from Apache's HTTP_COOKIE string and then add includes based on the contents of that string.

I've got this far:

<!--#set var="cookies" value="HTTP_COOKIE" -->
<p>COOKIES:  <!--#echo var="$cookies"--></p>

which gives me a string with all the cookies in it.

Now I want to be able to parse the string for something like Name=Bob.

I thought I'd be able to do this:

<!--#if expr="$cookies = /Name=([a-zA-Z]+)/"-->
<p>Your name is <!--#echo var="$1"--></p>
<!--#endif-->

But it doesn't seem to work. What should I be doing -- or isn't this possible?

A: 

This is definitely possible -- see the get_include_var function of mod_include.c.

Perhaps your regular expression needs some tweaking.

Greg
I can absolutely assure you that I tried with just about every form of regex known to personkind. Including no-brainers like just `[a-z]`
AmbroseChapel