Alteon Application Switch Operating System Application Guide
Layer 7 String Handling
Document ID: RDWR-ALOS-V2900_AG1302
803
Regular Expression Matching
Regular expressions are used to describe patterns for string matching. They enable you to match the
exact string, such as URLs, hostnames, or IP addresses. It is a powerful and effective way to express
complex rules for Layer 7 string matching. Both Layer 7 HTTP SLB and cache redirection can use
regular expressions as a resource. Configuring regular expressions can enhance content-based load
balancing in the following areas:
•
HTTP header matching
•
URL matching
Standard Regular Expression Characters
Table 68 includes a list of standard regular expression special characters that are supported by
Alteon:
Use the following rules when defining patterns for string matching:
•
Only one layer of parenthesis is supported.
•
Only a single "$" (match at end of line) is supported, which must appear at the end of the string.
For example, "abc$*def" is not supported.
•
The size of the user input string must be 40 characters or less.
•
The size of the regular expression structure after compilation cannot exceed 43 bytes for load-
balancing strings, and 23 bytes for cache redirection. The size of regular expressions after
compilation varies, based on the regular expression characters used in the user input string.
•
Use "/" at the beginning of the regular expression. Otherwise a regular expression will have "*"
prefixed to it. For example, "html/*\.htm" appears as "*html/*\.htm".
•
Incorrectly or ambiguously formatted regular expressions are rejected instantly. For example:
—
Where a "+" or "?" follows a special character, such as the "*" character.
—
A single "+" or "?" sign.
—
Unbalanced brackets and parenthesis.
Table 68: Standard Regular Expression Special Characters
Construction
Description
*
Matches any string of zero or more characters
.
Matches any single character
+
Matches one or more occurrences of the pattern it follows
?
Matches zero or one occurrences of its followed pattern
$
Matches the end of a line
\
Escape the following special character
[abc]
Matches any of the single character inside the bracket
[^abc]
Matches any single character except those inside the bracket
^
Matches the pattern exactly only if it appears at the beginning of a line