Applies To:

Show Versions Show Versions

Manual Chapter: Policy Management Guide for the BIG-IP WebAccelerator Module: C - Supporting Regular Expressions
Manual Chapter
Table of Contents   |   << Previous Chapter   |   Next Chapter >>


C

Supporting Regular Expressions


Using strings for regular expressions

The WebAccelerator system supports regular expressions throughout the product. When the WebAccelerator system performs pattern matching based on a whole-string, it assumes all regular expressions are in the form of ^expression$, even if you do not explicitly set the beginning of line (^) and end of line ($) indicators. For substring searches, you enter the form of a regular expression as *expression.*

The string that the WebAccelerator system matches is dependent on the HTTP data type for which you are providing the regular expression. The HTTP data types and string are defined in the Table C.12 .

Note

For further HTTP data type parameter definitions, see Table 5.1 , located in Chapter 5.
Table C.12 HTTP data types and string definitions
HTTP data type
String definition
host
The value set for the HTTP HOST request header.
For example, the WebAccelerator system matches the following HTTP HOST request header:
HOST: www.siterequest.com
To the following string:
www.siterequest.com
path
The value set for the path portion of the URI.
For example, for the following URI:
http://www.siterequest.com/apps/search.jsp
?value=computer
The WebAccelerator system matches to the following string:
/apps/search
extension
The value set for the extension portion of the URI.
For example, for the following URI:
http://www.siterequest.com/apps/search.jsp?value=computer
The WebAccelerator system matches to the following string:
jsp
query parameters
The value set for the identified query parameter.
For example, the WebAccelerator system matches the following value set for the action query parameter:
http://www.siterequest.com?action=display&PDA
To the following string:
display
unnamed query parameters
The value set for the identified query parameter.
For example, if the value set for the unnamed query parameter in ordinal 2 is as follows:
http://www.siterequest.com?action=display&PDA
The WebAccelerator system matches to the following string:
PDA
path segment
The name of the segment key, or the value set for the segment parameter, depending on what you have identified for the match.
For example, if you identify the path segment in ordinal 1 of the full path (counted from left-to-right) and parameter ordinal 0, that means that in the following URL you have identified the segment key:
http://www.siterequest.com/apps;AAY34/search.jsp
?value=computer
The WebAccelerator system matches to the following string:
apps
If you specify parameter ordinal 1, the WebAccelerator system matches to:
AAY34
cookie
The value set for the identified cookie.
For example, for the following cookie:
COOKIE: SESSIONID=TN2MM1QQL
The WebAccelerator system matches to the following string:
TN2MM1QQL
user agent
The value set for the HTTP USER_AGENT request header.
For example, for the following user agent:
USER_AGENT: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
The WebAccelerator system matches to the following string:
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
referrer
The value set for the HTTP REFERER request header.
For example, for the following referrer:
REFERER: http://www.siterequest.com?action=display
The WebAccelerator system matches to the following string:
http://www.siterequest.com?action=display
header
The value set for the identified header.
For example, for the following header:
Accept-Encoding: gzip
The WebAccelerator system matches to the following string:
gzip

Using meta characters for pattern matching

The WebAccelerator system uses the meta characters defined in the following table for pattern matching. You can use one of these meta characters as a literal value for fields that expect a regular expression, as long as you use the escape character.

Table C.13 Patterns and symbols to use for pattern matching
Pattern
Description
.
Matches any single character.
^
Matches the beginning of the line in a regular expression.
Note that the WebAccelerator system assumes that the beginning and end of line meta characters exist for every regular expression it sees.
$
Matches the end of the line.
Note that the WebAccelerator system assumes that the beginning and end of line meta characters exist for every regular expression it sees.
*
Matches zero or more of the patterns that precede it.
For example, the expression G.*P.* matches to the following:
GrandPlan
GreenPeace
GParse
GP
You can begin a pattern with the * character, which is the same as using the following:
.*
For example, the WebAccelerator system considers the following two expressions identical.
*Plan
.*Plan
+
Matches one or more of the patterns that precede it.
For example, the expression G.+P.* matches to the following:
GrandPlan
GreenPeace
Do not begin a pattern with the + character. For example:
+Plan
Instead, use the following:
.+Plan
?
Matches none, or one of the patterns that precede it.
For example, the expression G.?P.* matches to the following:
GParse
GP
Do not begin a pattern with the ? character. For example:
?Plan
Instead, use the following:
.?Plan
[...]
Matches a set of characters. You can list the characters in the set using a string made of the characters to match.
For example, the expression C[AHR] matches to the following:
CAT
CHARISMA
CRY
You can also provide a range of characters using a dash. For example, the expression AA[0-9]+ matches the following:
AA269812209
AA2
However, it does not match AAB2.
To match any alphanumeric character, both upper- and lowercase, use the following expression:
[a-zA-Z0-9]
[^...]
Matches any character not in the set. Just as with the character, [...], you can specify the individual characters, or a range of characters by using a dash (-).
For example, the expression C[^AHR].* matches the following:
CLEAR
CORY
CURRENT
But does not match:
CAT
CHARISMA
CRY
(...)
Matches the regular expression contained inside the parenthesis, as a group.
For example, the expression AA(12)+CV matches the following:
AA12CV
AA121212CV
exp1
exp2
Matches either exp1 or exp2, where exp1 and exp2 are regular expressions.
For example, the expression AA([de]12|[zy]13)CV matches the following:
AAd12CV
AAe12CV
AAz12CV
AAy13CV




Table of Contents   |   << Previous Chapter   |   Next Chapter >>

Was this resource helpful in solving your issue?




NOTE: Please do not provide personal information.



Incorrect answer. Please try again: Please enter the words to the right: Please enter the numbers you hear:

Additional Comments (optional)