expression

Regular-expression pattern element. Optional in <rule> elements.

Attributes

None.

Data

Regular-expression pattern string.

Description

The <expression> element can be empty or contain a simple search string or a regular-expression pattern. The pattern is applied to the entire request string.

A match always occurs when <expression> is empty or not specified; this is equivalent to specifying <expression>.*</expression>.

The implementation is based on the Java package java.util.regex, which provides a regular-expression syntax similar to Perl’s.

Note

The expression string must not contain literal < and & characters. These reserved characters can be encoded with & and <, respectively, or the entire string can be enclosed in an XML CDATA section:

<expression><![CDATA[&fmt=custom]]></expression>

All characters between the <expression> and </expression> tags are passed to the regular expression parser, including characters outside the optional CDATA section. Care should be taken to avoid extra whitespace.

See also

java.util.regex

On this page