Fortinet white logo
Fortinet white logo

Script Reference Guide

Class_search(list, method, str)

Class_search(list, method, str)

Searches an element in the list against a string.

Syntax

Class_search(list, method, str);

Arguments

Name Description

str

A string which will be calculated.

list

A string which will be matched.

method

A string which specifies the match method.

Events

Applicable in all events.

Example

when HTTP_REQUEST {
status, count, t = class_search(url_list, "starts_with", url);     --or "ends_with",  "equals", "contains"
for k,v in pairs(t) do
debug("index %s, value %s\n", k,v);
end
}

Note:

Method: , must be “starts_with”, “equals”, “contains”, “end_with”

Supported Version

FortiADC version 5.2.x and later.

Class_search(list, method, str)

Class_search(list, method, str)

Searches an element in the list against a string.

Syntax

Class_search(list, method, str);

Arguments

Name Description

str

A string which will be calculated.

list

A string which will be matched.

method

A string which specifies the match method.

Events

Applicable in all events.

Example

when HTTP_REQUEST {
status, count, t = class_search(url_list, "starts_with", url);     --or "ends_with",  "equals", "contains"
for k,v in pairs(t) do
debug("index %s, value %s\n", k,v);
end
}

Note:

Method: , must be “starts_with”, “equals”, “contains”, “end_with”

Supported Version

FortiADC version 5.2.x and later.