From: Eric Covener Date: Mon, 27 Dec 2010 22:41:00 +0000 (+0000) Subject: provide a mod_substitute example that uses backreferences X-Git-Tag: 2.3.11~342 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=544fd0542bcb7ceac8bad71c9c61e7ec4d9fea54;p=thirdparty%2Fapache%2Fhttpd.git provide a mod_substitute example that uses backreferences for matching as well as for substitution. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053212 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_substitute.html.en b/docs/manual/mod/mod_substitute.html.en index 9f2cd5086a8..6914e6bfd27 100644 --- a/docs/manual/mod/mod_substitute.html.en +++ b/docs/manual/mod/mod_substitute.html.en @@ -97,6 +97,18 @@ </Location>

+

Backreferences can be used in the comparison and in the substituion, + when regular expressions are used, as illustrated in the following example:

+

Example of using backreferences and captures

+ <Location /> + + AddOutputFilterByType SUBSTITUTE text/html
+ # "foo=k,bar=k" -> "foo/bar=k"
+ Substitute "s|foo=(\w+),bar=\1|foo/bar=$1" +
+ </Location> +

+

A common use scenario for mod_substitute is the situation in which a front-end server proxies requests to a back-end server which returns HTML with hard-coded embedded URLs that refer diff --git a/docs/manual/mod/mod_substitute.xml b/docs/manual/mod/mod_substitute.xml index fb97f88f257..7191740b856 100644 --- a/docs/manual/mod/mod_substitute.xml +++ b/docs/manual/mod/mod_substitute.xml @@ -91,6 +91,18 @@ </Location> +

Backreferences can be used in the comparison and in the substituion, + when regular expressions are used, as illustrated in the following example:

+ Example of using backreferences and captures + <Location /> + + AddOutputFilterByType SUBSTITUTE text/html
+ # "foo=k,bar=k" -> "foo/bar=k"
+ Substitute "s|foo=(\w+),bar=\1|foo/bar=$1" +
+ </Location> +
+

A common use scenario for mod_substitute is the situation in which a front-end server proxies requests to a back-end server which returns HTML with hard-coded embedded URLs that refer