Basic operations on text
String comparison functions
| Function | Description |
|---|---|
<text>.CONTAINS(<string>) |
Returns a Boolean TRUE value if the target contains <string>. Example: http.req.url.contains(".jpeg") |
<text>.EQ(<string>) |
Returns a Boolean TRUE value if the target is an exact match with <string>. For example, the following expression returns a Boolean TRUE for a URL with a host name of "myhostabc": http.req.url.hostname.eq("myhostabc") |
<text>.STARTSWITH(<string>) |
Returns a Boolean TRUE value if the target begins with <string>. For example, the following expression returns a Boolean TRUE for a URL with a host name of "myhostabc": http.req.url.hostname.startswith("myhost") |
<text>.ENDSWITH(<string>) |
Returns a Boolean TRUE value if the target ends with <string>. For example, the following expression returns a Boolean TRUE for a URL with a host name of "myhostabc": http.req.url.hostname.endswith("abc") |
<text>.NE(<string>) |
Returns a Boolean TRUE value if the prefix is not equal to the string argument. If the prefix returns a non-string value, the function argument is compared to the string representation of the value returned by the prefix. You can use the functions with SET_TEXT_MODE(IGNORECASE) or SET_TEXT_MODE(NOIGNORECASE), and with both ASCII and UTF-8 character sets. |
<text>.GT(<string>) |
Returns a Boolean TRUE value if the prefix is alphabetically greater than the string argument. If the prefix returns a non-string value, the function argument is compared to the string representation of the value returned by the prefix. You can use the functions with SET_TEXT_MODE(IGNORECASE) or SET_TEXT_MODE(NOIGNORECASE), and with both ASCII and UTF-8 character sets. |
<text>.GE(<string>) |
Returns a Boolean TRUE value if the prefix is alphabetically greater than or equal to the string argument. If the prefix returns a non-string value, the function argument is compared to the string representation of the value returned by the prefix. You can use the functions with SET_TEXT_MODE(IGNORECASE) or SET_TEXT_MODE(NOIGNORECASE), and with both ASCII and UTF-8 character sets. |
<text>.LT(<string>) |
Returns a Boolean TRUE value if the prefix is alphabetically lesser than the string argument. If the prefix returns a non-string value, the function argument is compared to the string representation of the value returned by the prefix. You can use the functions with SET_TEXT_MODE(IGNORECASE) or SET_TEXT_MODE(NOIGNORECASE), and with both ASCII and UTF-8 character sets. |
<text>.LE(<string>) |
Returns a Boolean TRUE value if the prefix is alphabetically lesser than or equal to the string argument. If the prefix returns a non-string value, the function argument is compared to the string representation of the value returned by the prefix. You can use the functions with SET_TEXT_MODE(IGNORECASE) or SET_TEXT_MODE(NOIGNORECASE), and with both ASCII and UTF-8 character sets. |
Calculate the length of a string
<text>.LENGTH operation returns a numeric value that is equal to the number of characters (not bytes) in a string:
<text>.LENGTH
HTTP.REQ.URL.LENGTH < 500
Consider, ignore, and change text case
| Function | Description | |
|---|---|---|
<text>.SET_TEXT_MODE(IGNORECASE |
NOIGNORECASE) | This function turns case sensitivity on or off for all text operations. |
<text>.TO_LOWER |
Converts the target to lowercase for a text block of up to 2 kilobyte (KB). Returns UNDEF if the target exceeds 2 KB. For example, the string “ABCd:” is converted to “abcd:”. | |
<text>.TO_UPPER |
Converts the target to uppercase. Returns UNDEF if the target exceeds 2 KB. For example, the string “abcD:” is converted to “ABCD:”. |
Strip specific characters from a string
<string>) function to remove specific characters from the text that is returned by a Advanced policy expression prefix (the input string). All instances of the characters that you specify in the argument are stripped from the input string. You can use any text method on the resulting string, including the methods used for matching the string with a pattern set.
CLIENT.UDP.DNS.DOMAIN.STRIP\_CHARS(".-\_"), the STRIP\_CHARS(<string>) function strips all periods (.), hyphens (-), and underscores (_) from the domain name returned by the prefix CLIENT.UDP.DNS.DOMAIN. If the domain name that is returned is "a.dom_ai_n-name", the function returns the string "adomainname".
CLIENT.UDP.DNS.DOMAIN.STRIP_CHARS(".-_").CONTAINS_ANY("listofdomains")
STRIP_CHARS(<string>) function.
| Function | Description |
|---|---|
<text>.STRIP_START_CHARS(s) |
Strips matching characters from the beginning of the input string until the first non-matching character is found and returns the remainder of the string. You must specify the characters that you want to strip as a single string within quotation marks. For example, if the name of a header is TestLang and :/_en_us:is its value,HTTP.RES.HEADER("TestLang").STRIP_START_CHARS(":_")strips the specified characters from the beginning of the value of the header until the first non-matching character e is found and returnsen_us: as a string. |
<text>.STRIP_END_CHARS(s) |
Strips matching characters from the end of the input string to the first non-matching character is found and returns the remainder of the string. You must specify the characters that you want to strip as a single string within quotation marks. For example, if the name of a header is TestLang and :/_en_us:is its value,HTTP.RES.HEADER("TestLang").STRIP_START_CHARS(":_")strips the specified characters from the end of the value of the header until the first non-matching character s is found and returns:/_en_us as a string. |