httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57448] SSI <!--#set --> cannot capture backreferences from regex match in <!--#if -->
Date Fri, 26 Feb 2016 10:27:34 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=57448

--- Comment #6 from Ingmar Eveslage <eveslage@gmail.com> ---
i boiled it down a litte:

at first: there has to be an indirection with "<!--#set var". echoing directly
"$0" doesn't work.

my example shows a work around: 

<!--#set var="test_var" value="1_2_3_4" --> 
<!--#if expr='v("test_var") =~ /(1_)(.*)/ && $1 =~ /(.*)/' --><!--#endif
-->
<!--#set var="first" value="$0" -->
<!--#echo encoding='none' var='first' -->

OUTPUT: 1_

changing the second regex in the if statement to $2

<!--#set var="test_var" value="1_2_3_4" --> 
<!--#if expr='v("test_var") =~ /(1_)(.*)/ && $2 =~ /(.*)/' --><!--#endif
-->
<!--#set var="first" value="$0" -->
<!--#echo encoding='none' var='first' -->

OUTPUT: 2_3_4

so the simple "$n =~ /(.*)/" acts like an exporter for matched parts.
BUT BE AWARE: don't simplify it "$n =~ /.*/" doesn't work.

i think the bug report stands. somethings doesn't add up.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message