I’m trying to use the ^preg_replace
keyword modifier in an esi:when test
statement but I’m having difficulty getting it to work. The ^preg_match
modifier seems to work fine, but it’s not quite what I need in this instance.
In this case, I’m interrogating the contents of a cookie to return segmented content.
The following works fine (FYI - %globals_cookie_example^preg_match:12345%
returns 1):
<esi:when test="(%globals_cookie_example^preg_match:12345% == 1)">
<h2>Some content</h2>
</esi:when>
But this next statement doesn’t (FYI - %globals_cookie_example^preg_replace:12345%
returns ‘desiredValue’):
<esi:when test="(%globals_cookie_example^preg_replace:12345% == 'desiredValue')">`
<h2>Some content</h2>
</esi:when>
Any ideas why that might be the case? Is preg_replace
performed on the server where preg_match
is not?