
Brocade Virtual ADX OpenScript API Guide 111
53-1003243-01
Methods
9
Return values
None
Example
OS_PAYLOAD_INSPECT::match(regexp1, [regexp2 …])
Specifies the regular expressions to match.
Context
This function can be called by the HTTP_REQUEST or HTTP_RESPONSE event.
This function triggers the PAYLOAD_INSPECT_MATCHED event for each matched regular
expression. Calling the OS_PAYLOAD_INSPECT::matched_str () API in the
PAYLOAD_INSPECT_MATCHED handler returns the currently matched sub-string only.
Usage
Each input argument for this function is associated with the corresponding input argument pair to
the OS_PAYLOAD_INSPECT::matched_replace(mstr1, rstr1, [mstr2, rstr2, …]) API. For example, the
first argument regexp1 works only with mstr1 and rstr1 to define the call behavior of both APIs.
When regexp1 is found and matched in the payload stream, a matched event is triggered and,
during this event, only mstr1 is searched for and replaced by rstr1. Similarly, when regexp2 is found
and matched, only mstr2 is searched for and replaced by rstr2 in the matched event script.
You can provide a maximum of three input parameters. If you enter more than three parameters,
the additional parameters are silently dropped but debugging messages are displayed.
regexp3 regular expression An optional additional regular expression to match with a maximum
length of 128 bytes.
string3 string The replacement string for the regexp3 matched regular expression.
The string can be a fixed length only with a maximum length of
128 bytes.
TABLE 130 Input values (Continued)
Name Type Description
use OS_HTTP_RESPONSE;
use OS_PAYLOAD_INSPECT;
sub HTTP_RESPONSE {
if (OS_HTTP_RESPONSE::content_type =~ /text/) {
OS_PAYLOAD_INSPECT::substitute(
‘credit*card=[0-9]{32}’, ‘#### ####’,
‘SSN=[0-9]{9}’, ‘###-##-####’
);
}
}
Komentarze do niniejszej Instrukcji