You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2006/01/31 02:50:55 UTC

svn commit: r373664 - in /httpd/httpd/branches/2.2.x/docs/manual/rewrite: rewrite_intro.html.en rewrite_intro.xml

Author: rbowen
Date: Mon Jan 30 17:50:52 2006
New Revision: 373664

URL: http://svn.apache.org/viewcvs?rev=373664&view=rev
Log:
A few more terms added to the regex vocabulary lesson.

Modified:
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en?rev=373664&r1=373663&r2=373664&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.html.en Mon Jan 30 17:50:52 2006
@@ -73,15 +73,46 @@
 <h3><a name="regexvocab" id="regexvocab">Regex vocabulary</a></h3>
 
 <p>The following are the minimal building blocks you will need, in order
-to write regular expressions and <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>s.</p>
+to write regular expressions and <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>s. They certainly do not
+represent a complete regular expression vocabulary, but they are a good
+place to start, and should help you read basic regular expressions, as
+well as write your own.</p>
 
 <table>
 <tr>
 <th>Character</th>
 <th>Meaning</th>
+<th>Example</th>
 </tr>
 
-<tr><td><code>.</code></td><td>Matches any character</td></tr>
+<tr><td><code>.</code></td><td>Matches any
+character</td><td><code>c.t</code> will match <code>cat</code>,
+<code>cot</code>, <code>cut</code>, etc.</td></tr>
+<tr><td><code>+</code></td><td>Repeats the previous match one or more
+times</td><td><code>a+</code> matches <code>a</code>, <code>aa</code>, 
+<code>aaa</code>, etc</td></tr>
+<tr><td><code>*</code></td><td>Repeats the previous match zero or more
+times.</td><td><code>a*</code> matches all the same things
+<code>a+</code> matches, but will also match an empty string.</td></tr>
+<tr><td><code>?</code></td><td>Makes the match optional.</td><td /></tr>
+<tr><td><code>.</code></td><td>Matches any
+character</td><td><code>colou?r</code> will match <code>color</code> and
+<code>colour</code>.</td></tr>
+<tr><td><code>^</code></td><td>Called an anchor, matches the beginning
+of the string</td><td><code>^a</code> matches a string that begins with
+<code>a</code></td></tr>
+<tr><td><code>$</code></td><td>The other anchor, this matches the end of
+the string.</td><td><code>a$</code> matches a string that ends with
+<code>a</code>.</td></tr>
+<tr><td><code>( )</code></td><td>Groups several characters into a single
+unit, and captures a match for use in a backreference.</td><td><code>(ab)+</code> 
+matches <code>ababab</code> - that is, the <code>+</code> applies to the group.
+For more on backreferences see <a href="#InternalBackRefs">below</a>.</td></tr>
+<tr><td><code>[ ]</code></td><td>A character class - matches one of the
+characters</td><td><code>c[uoa]t</code> matches <code>cut</code>,
+<code>cot</code> or <code>cat</code>.</td></tr>
+<tr><td><code>!</code></td><td>Not</td><td>Negates a match - that is,
+ensures that it does not match.</td></tr>
 
 </table>
 

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml?rev=373664&r1=373663&r2=373664&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/rewrite_intro.xml Mon Jan 30 17:50:52 2006
@@ -75,15 +75,46 @@
 
 <p>The following are the minimal building blocks you will need, in order
 to write regular expressions and <directive
-module="mod_rewrite">RewriteRule</directive>s.</p>
+module="mod_rewrite">RewriteRule</directive>s. They certainly do not
+represent a complete regular expression vocabulary, but they are a good
+place to start, and should help you read basic regular expressions, as
+well as write your own.</p>
 
 <table>
 <tr>
 <th>Character</th>
 <th>Meaning</th>
+<th>Example</th>
 </tr>
 
-<tr><td><code>.</code></td><td>Matches any character</td></tr>
+<tr><td><code>.</code></td><td>Matches any
+character</td><td><code>c.t</code> will match <code>cat</code>,
+<code>cot</code>, <code>cut</code>, etc.</td></tr>
+<tr><td><code>+</code></td><td>Repeats the previous match one or more
+times</td><td><code>a+</code> matches <code>a</code>, <code>aa</code>, 
+<code>aaa</code>, etc</td></tr>
+<tr><td><code>*</code></td><td>Repeats the previous match zero or more
+times.</td><td><code>a*</code> matches all the same things
+<code>a+</code> matches, but will also match an empty string.</td></tr>
+<tr><td><code>?</code></td><td>Makes the match optional.</td><td></td></tr>
+<tr><td><code>.</code></td><td>Matches any
+character</td><td><code>colou?r</code> will match <code>color</code> and
+<code>colour</code>.</td></tr>
+<tr><td><code>^</code></td><td>Called an anchor, matches the beginning
+of the string</td><td><code>^a</code> matches a string that begins with
+<code>a</code></td></tr>
+<tr><td><code>$</code></td><td>The other anchor, this matches the end of
+the string.</td><td><code>a$</code> matches a string that ends with
+<code>a</code>.</td></tr>
+<tr><td><code>( )</code></td><td>Groups several characters into a single
+unit, and captures a match for use in a backreference.</td><td><code>(ab)+</code> 
+matches <code>ababab</code> - that is, the <code>+</code> applies to the group.
+For more on backreferences see <a href="#InternalBackRefs">below</a>.</td></tr>
+<tr><td><code>[ ]</code></td><td>A character class - matches one of the
+characters</td><td><code>c[uoa]t</code> matches <code>cut</code>,
+<code>cot</code> or <code>cat</code>.</td></tr>
+<tr><td><code>!</code></td><td>Not</td><td>Negates a match - that is,
+ensures that it does not match.</td></tr>
 
 </table>