24
Copyright © 2000 - 2005 KEMP Technologies, Inc. All Rights Reserved.
A regular expression: The rule will match if the URL contains a string, which matches the given Regular
expression.
I.e. If a rule has a value “home/*.gif”, then all requests for “/home/…./XXX.gif” will match the rule.
Any rule can also be negated: In this case, the rule will match if the string does NOT match the given rule.
I.e. if a NEGATED postfix rule has the value “.gif”, then it will match all requests which do NOT end if
“.gif”. For example the URL “/home/…./XXX.jpg” will be matched by the rule.
1.1. Special Characters
The strings used for the prefix and postfix operations can contain any character, which is permitted in a URL.
“Special” Regular expression characters are taken as literal characters. I.e. When using prefix or postfix
operations a rule such as “home/*” will only match if the string contains a “*” character at the relevant
position.
The use of the “%<hex><hex>” characters is allowed in all strings. This construct will allow a user to input
“Unsafe” characters into the string. The construct “%%” will be treated as a single “%” during matching.
All match strings are case dependent.
1.2. Regular expressions
A Regular expression is a sequence of characters. Any character, which is not a special character, will match
itself. The following special characters are defined.
“^”
This can only be placed at the start of the string and means that the string must match at the start of
the URL.
“$”
This can only be placed at the end of the string and means that the string must match at the end of
the URL.
“?”
This matches any single character.
“*”
This matches zero or more characters.
“[ ”
This starts the set notation. This matches a SINGLE character, which is contained within a set. If the
set starts with a “^”, then this will match a SINGLE character which is NOT within the set.
I.e.
The sequence “[0-9]” will match any single digit.
The sequence “[^abf]” will match any character, which is not an “a”, “b” or an “f”.
The sequence “^/[^a-z]” will match any first character in the URL which is not a small letter.
Examples
Here are a few examples:
“/home/*.gif” This will match any URL which points to a “.gif” file in the “/home” directory.
“[gG][iI][fF]” This will match any URL which contains the string “gif” or “GIF” or “gIF” of “giF” of “GiF” etc.
Note: Given an input URL such as “/home/cgi-bin/XXX.cmd?value=hello”, the end of the string used in
matching is terminated by the “?” character. I.e. a postfix string of “cmd” will match this URL, while a postfix
of “hello” will not.
1.3. Host name matching
The host part of a HTTP/1.1 URI can be prepended to the request URL before any matching is attempted. This
means that the complete string between the protocol definition and the end of the URL is used for the
matching.
http://www.a-host.com/content/example/request.cgi?value=”hello”