Using Apache 2.4.10 (ap_expr in no legacy mode), the following SSI does not return the expected capturing group:
<!--#set var="keyvaluepair" value="key1=value1" -->
<!--#if expr="v('keyvaluepair')=~/key1=([a-zA-Z0-9]*)/" -->
<!--#set var="match" value="$0" -->
<!--#set var="value" value="$1" -->
<!--#endif -->
keyvaluepair:<!--#echo var="keyvaluepair" -->
<br>regex: /key1=([a-zA-Z0-9]*)/
<br>match:<!--#echo var="match" -->
<br>value:<!--#echo var="value" -->
<br>expected value: value1
<br>Why is $1 empty?
Because of parenthesis around [a-zA-Z0-9]* in the regular expression, I would expect $1 to be just that capturing group, which should be the value only. Why is that empty?
Olaf
Edit: $1 seems only to work in legacy mode (SSILegacyExprParser on), using $ instead of v() function, (?:^|&) instead of \b and not using =~:
<!--#if expr="$keyvaluepair = /(?:^|&)key1=([a-zA-Z0-9]*)/" -->
Is there perhaps a change in how to mark/delimit capturing groups in the newer ap_expr syntax?