optimization in the case of no request body. PR 48359
[Jake Scott, William Rowe, Ruediger Pluem]
+ *) Make ap_pregsub(), used by AliasMatch and friends, use the same syntax
+ for regex backreferences as mod_rewrite and mod_include: Remove the use
+ of '&' as an alias for '$0' and allow to escape any character with a
+ backslash. PR 48351. [Stefan Fritsch]
+
*) Turn static function get_server_name_for_url() into public
ap_get_server_name_for_url() and use it where appropriate. This
fixes mod_rewrite generating invalid URLs for redirects to IPv6
*) mod_cache: Do an exact match of the keys defined by
CacheIgnoreURLSessionIdentifiers against the querystring instead of
- a partial match. PR 48401.i
+ a partial match. PR 48401.
[Dodou Wang <wangdong.08 gmail.com>, Ruediger Pluem]
*) mod_proxy_balancer: Fix crash in balancer-manager. [Rainer Jung]
expressions are useful in Apache because they let you apply certain
attributes against collections of files or resources in very flexible ways
- for example, all .gif and .jpg files under any "images" directory could
- be written as "<code>/images/.*(jpg|gif)$</code>". Apache uses Perl
- Compatible Regular Expressions provided by the <a href="http://www.pcre.org/">PCRE</a> library. You can find more documentation
- about PCRE's regular expression syntax at that site, or at
+ be written as "<code>/images/.*(jpg|gif)$</code>". In places where
+ regular expressions are used to replace strings, the special variables
+ $1 ... $9 contain backreferences to the grouped parts (in parentheses) of
+ the matched expression. The special variable $0 contains a backerference
+ to the whole matched expression. To write a literal dollar sign in a
+ replacement string, it can be escaped with a backslash. Historically, the
+ variable & could be used as alias for $0 in some places. This is no
+ longer possible since version 2.3.5. Apache uses Perl Compatible Regular
+ Expressions provided by the <a href="http://www.pcre.org/">PCRE</a>
+ library. You can find more documentation about PCRE's regular expression
+ syntax at that site, or at
<a href="http://en.wikipedia.org/wiki/PCRE">Wikipedia</a>.
</dd>
expressions are useful in Apache because they let you apply certain
attributes against collections of files or resources in very flexible ways
- for example, all .gif and .jpg files under any "images" directory could
- be written as "<code>/images/.*(jpg|gif)$</code>". Apache uses Perl
- Compatible Regular Expressions provided by the <a
- href="http://www.pcre.org/">PCRE</a> library. You can find more documentation
- about PCRE's regular expression syntax at that site, or at
+ be written as "<code>/images/.*(jpg|gif)$</code>". In places where
+ regular expressions are used to replace strings, the special variables
+ $1 ... $9 contain backreferences to the grouped parts (in parentheses) of
+ the matched expression. The special variable $0 contains a backerference
+ to the whole matched expression. To write a literal dollar sign in a
+ replacement string, it can be escaped with a backslash. Historically, the
+ variable & could be used as alias for $0 in some places. This is no
+ longer possible since version 2.3.5. Apache uses Perl Compatible Regular
+ Expressions provided by the <a href="http://www.pcre.org/">PCRE</a>
+ library. You can find more documentation about PCRE's regular expression
+ syntax at that site, or at
<a href="http://en.wikipedia.org/wiki/PCRE">Wikipedia</a>.
</dd>
<p>If you are matching positive (<code>=</code> or <code>==</code>), you
can capture grouped parts of the regular expression. The captured parts
are stored in the special variables <code>$1</code> ..
- <code>$9</code>.</p>
+ <code>$9</code>. The whole string matched by the regular expression is
+ stored in the special variable <code>$0</code></p>
<div class="example"><h3>Example</h3><p><code>
<!--#if expr="$QUERY_STRING = /^sid=([a-zA-Z0-9]+)/" --><br />
<p>If you are matching positive (<code>=</code> or <code>==</code>), you
can capture grouped parts of the regular expression. The captured parts
are stored in the special variables <code>$1</code> ..
- <code>$9</code>.</p>
+ <code>$9</code>. The whole string matched by the regular expression is
+ stored in the special variable <code>$0</code></p>
<example><title>Example</title>
<!--#if expr="$QUERY_STRING = /^sid=([a-zA-Z0-9]+)/" --><br />
<li>
<strong>RewriteRule backreferences</strong>: These are
backreferences of the form <strong><code>$N</code></strong>
- (0 <= N <= 9), which provide access to the grouped
+ (0 <= N <= 9). $1 to $9 provide access to the grouped
parts (in parentheses) of the pattern, from the
<code>RewriteRule</code> which is subject to the current
- set of <code>RewriteCond</code> conditions.
+ set of <code>RewriteCond</code> conditions. $0 provides
+ access to the whole string matched by that pattern.
</li>
<li>
<strong>RewriteCond backreferences</strong>: These are
backreferences of the form <strong><code>%N</code></strong>
- (1 <= N <= 9), which provide access to the grouped
+ (0 <= N <= 9). %1 to %9 provide access to the grouped
parts (again, in parentheses) of the pattern, from the last matched
<code>RewriteCond</code> in the current set
- of conditions.
+ of conditions. %0 provides access to the whole string matched by
+ that pattern.
</li>
<li>
<strong>RewriteMap expansions</strong>: These are
<li>
<strong>RewriteRule backreferences</strong>: These are
backreferences of the form <strong><code>$N</code></strong>
- (0 <= N <= 9), which provide access to the grouped
+ (0 <= N <= 9). $1 to $9 provide access to the grouped
parts (in parentheses) of the pattern, from the
<code>RewriteRule</code> which is subject to the current
- set of <code>RewriteCond</code> conditions.
+ set of <code>RewriteCond</code> conditions. $0 provides
+ access to the whole string matched by that pattern.
</li>
<li>
<strong>RewriteCond backreferences</strong>: These are
backreferences of the form <strong><code>%N</code></strong>
- (1 <= N <= 9), which provide access to the grouped
+ (0 <= N <= 9). %1 to %9 provide access to the grouped
parts (again, in parentheses) of the pattern, from the last matched
<code>RewriteCond</code> in the current set
- of conditions.
+ of conditions. %0 provides access to the whole string matched by
+ that pattern.
</li>
<li>
<strong>RewriteMap expansions</strong>: These are
len = 0;
while ((c = *src++) != '\0') {
- if (c == '&')
- no = 0;
- else if (c == '$' && apr_isdigit(*src))
+ if (c == '$' && apr_isdigit(*src))
no = *src++ - '0';
else
no = 10;
if (no > 9) { /* Ordinary character. */
- if (c == '\\' && (*src == '$' || *src == '&'))
+ if (c == '\\' && *src)
c = *src++;
len++;
}