https://issues.apache.org/bugzilla/show_bug.cgi?id=53387
Priority: P2
Bug ID: 53387
Assignee: [email protected]
Summary: SSI: Allow to use $1 to get result of regular
expression matching
Severity: enhancement
Classification: Unclassified
OS: Windows XP
Reporter: [email protected]
Hardware: PC
Status: NEW
Version: 7.0.27
Component: Catalina
Product: Tomcat 7
This was originally reported in bug 48956, but it is a separate issue.
In Apache HTTPD there is such example in documentation of mod_include: [1]
[[[
<!--#if expr="$QUERY_STRING = /^sid=([a-zA-Z0-9]+)/" -->
<!--#set var="session" value="$1" -->
<!--#endif -->
]]]
[1] http://httpd.apache.org/docs/current/mod/mod_include.html
Here $1 references the value of group #1 as caught by regular expression.
Example from comment 3 in bug 48956:
[[[
<!--#set var="aux" value="aa12" -->
<!--#if expr="$aux=/^aa([a-zA-Z0-9\-_]*)/" -->
<!--#set var="aux2" value="$1" -->
<!--#endif -->
Resulting value:<!--#echo var="aux2" -->
]]]
In Tomcat support for regular expression in SSI was added in r1136231 and
r1136399 and is implemented in
ExpressionParseTree$CompareNode#compareBranches()
Maybe the last used Matcher can be stored in some context, so that it can be
later used to resolve $1 etc. references. I do not know whether $1 is limited
to that #if, or it is available everywhere later until it is overwritten by the
next regexp-matching operation. I do not know how HTTPD behaves here. I think
the latter would be easier to implement.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]