Parse the HTTP_COOKIES string from Apache for use in #if clause
- by Ambrose
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?