]> granicus.if.org Git - apache/commitdiff
provide a mod_substitute example that uses backreferences
authorEric Covener <covener@apache.org>
Mon, 27 Dec 2010 22:41:00 +0000 (22:41 +0000)
committerEric Covener <covener@apache.org>
Mon, 27 Dec 2010 22:41:00 +0000 (22:41 +0000)
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

docs/manual/mod/mod_substitute.html.en
docs/manual/mod/mod_substitute.xml

index 9f2cd5086a8e29c8aed90c2ef9afdf02a899cbda..6914e6bfd2749a1f318d5c847b8ae415aab12901 100644 (file)
         &lt;/Location&gt;
     </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
index fb97f88f2577ee56375889275d6e25391b2c0b75..7191740b8561eb3dfefe9933848af3b4214cae18 100644 (file)
         &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