You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2010/12/27 23:41:01 UTC

svn commit: r1053212 - in /httpd/httpd/trunk/docs/manual/mod: mod_substitute.html.en mod_substitute.xml

Author: covener
Date: Mon Dec 27 22:41:00 2010
New Revision: 1053212

URL: http://svn.apache.org/viewvc?rev=1053212&view=rev
Log:
provide a mod_substitute example that uses backreferences
for matching as well as for substitution.


Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_substitute.html.en
    httpd/httpd/trunk/docs/manual/mod/mod_substitute.xml

Modified: httpd/httpd/trunk/docs/manual/mod/mod_substitute.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_substitute.html.en?rev=1053212&r1=1053211&r2=1053212&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_substitute.html.en (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_substitute.html.en Mon Dec 27 22:41:00 2010
@@ -97,6 +97,18 @@
         </Location>
     </code></p></div>
 
+    <p>Backreferences can be used in the comparison and in the substituion,
+    when regular expressions are used, as illustrated in the following example: </p>
+    <div class="example"><h3>Example of using backreferences and captures</h3><p><code>
+        &lt;Location /&gt;
+        <span class="indent">
+            AddOutputFilterByType SUBSTITUTE text/html<br />
+            # "foo=k,bar=k" -&gt; "foo/bar=k" <br />
+            Substitute "s|foo=(\w+),bar=\1|foo/bar=$1"
+        </span>
+        &lt;/Location&gt;
+    </code></p></div>
+
     <p>A common use scenario for <code>mod_substitute</code> 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

Modified: httpd/httpd/trunk/docs/manual/mod/mod_substitute.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_substitute.xml?rev=1053212&r1=1053211&r2=1053212&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_substitute.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_substitute.xml Mon Dec 27 22:41:00 2010
@@ -91,6 +91,18 @@
         &lt;/Location&gt;
     </example>
 
+    <p>Backreferences can be used in the comparison and in the substituion,
+    when regular expressions are used, as illustrated in the following example: </p>
+    <example><title>Example of using backreferences and captures</title>
+        &lt;Location /&gt;
+        <indent>
+            AddOutputFilterByType SUBSTITUTE text/html<br />
+            # "foo=k,bar=k" -> "foo/bar=k" <br />
+            Substitute "s|foo=(\w+),bar=\1|foo/bar=$1"
+        </indent>
+        &lt;/Location&gt;
+    </example>
+
     <p>A common use scenario for <code>mod_substitute</code> 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