Class_match(str, method, list)
Matches the string against an element.
Syntax
Class_match(str, method, list);
Arguments
| Name | Description |
|---|---|
|
str |
A string which will be matched. |
|
method |
A string which specifies the match method |
|
list |
A list which specifies the match target. |
Events
Applicable in all events.
Example
when HTTP_REQUEST {
url_list = “”
url = HTTP:uri_get()
status, count, t = class_match(url, "starts_with", url_list); --or "ends_with", "equals", "contains"
debug("status %s, count %s\n", status, count);
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”
This command return three parameters, first “status”: true or false means if match or not; second “count”: return the number of times matches; third “t”: return matched index and matched value in the list.
Supported Version
FortiADC version 5.2.x and later.