Syntax

A value can be defined for certain match conditions and features. This value may consist of:

The manner in which special characters will be treated varies according to how a match condition or feature handles text values. A match condition or feature may interpret text in one of the following ways:

Literal Values

Text that is interpreted as a literal value will treat all special characters, with the exception of the % symbol, as a part of the value that must be matched. In other words, a literal match condition set to "\'*'\" will only be satisfied when that exact value (i.e., \'*'\) is found.

A percentage symbol is used to indicate URL encoding (e.g., %20).

Literal match conditions encompass all match conditions that do not support wildcards or regular expressions.

Wildcard Values (Special Characters)

Text that is interpreted as a wildcard value will assign additional meaning to special characters. The following table describes how the following set of characters will be interpreted.

Character Description

\

A backslash escapes any of the characters defined within this table. A backslash must be specified directly before the special character that should be escaped.

For example, the following syntax escapes an asterisk:

\*

%

A percentage symbol is used to indicate URL encoding (e.g., %20).

*

An asterisk is a wildcard that represents zero or more characters.

Space

A space character indicates that a match condition may be satisfied by either of the specified values or patterns.

'value'

A single quote does not have special meaning. However, a set of single quotes is used to indicate that a value should be treated as a literal value. A literal value serves the following purposes:

  • It allows a match condition to be satisfied whenever the specified value matches any portion of the comparison value.

    For example, 'ma' would match any of the following strings:

    • /business/marathon/asset.htm
    • map.gif
    • /business/template.map
  • It allows a special character to be specified as a literal character. For example, you may specify a literal space character by enclosing a space character within a set of single quotes (i.e., ' ' or 'sample literal value').
  • It allows a blank value to be specified. Specify a blank value by specifying a set of single quotes (i.e., '').

Key information:

  • If the specified value does not contain a wildcard, then it will automatically be considered a literal value. This means that it is not necessary to specify a set of single quotes.
  • If a backslash does not escape another character in this table, then it will be ignored when specified within a set of single quotes.
  • Another way to specify a special character as a literal character is to escape it using a backslash (i.e., \).

Regular Expressions

Regular expressions define a pattern that will be searched for within a text value. Regular expression notation defines specific meanings to a variety of symbols. The following table indicates how special characters are treated by match conditions and features that support regular expressions.

Match conditions and features that support regular expressions are only available with Rules Engine - Advanced Rules. For more information, please contact your CDN account manager.

This section solely highlights how regular expression match conditions and features handle "special characters." The information provided here is not meant to be a comprehensive guide on regular expression usage or syntax.

Special Character Description

\

A backslash in a regular expression typically:

  • Defines a shorthand character class (e.g., \d instead of [0-9]).
  • Escapes the character that follows it. This causes that character to be treated as a literal value instead of taking on its regular expression meaning.

    For example, the following syntax escapes an asterisk:

    \*

Match Conditions

A single backslash is always ignored when defining a regular expression for a match condition.

Please contact our customer support team if you would like to escape a special character when defining a regular expression for a match condition.

Features

A backslash is interpreted according to standard regular expression syntax.

%

The meaning of a percentage symbol depends on its usage.

  • %{HTTPVariable}: This syntax identifies an HTTP variable.
  • %{HTTPVariable%Pattern}: This syntax uses a percentage symbol to identify an HTTP variable and as a delimiter.
  • \%: Escaping a percentage symbol allows it to be used as a literal value or to indicate URL encoding (e.g., \%20).

*

An asterisk allows the preceding character to be matched zero or more times.

Space

A space character is typically treated as a literal character.

'value'

Single quotes are treated as literal characters. A set of single quotes does not have special meaning.