Chapter 9 Advanced Expressions: String Sets, String Patterns, and Data Formats 167
text.REGEX_MATCH(regular
expression)Returns TRUE if the target matches a regular
expression argument of up to 1499 characters.
The regular expression must be of the following
format:
re<delimiter>regular expression<
delimiter>
Both delimiters must be the same. Additionally, the
regular expression must conform to the Perl-
compatible (PCRE) regular expression library
syntax. For more information, go to http://
www.pcre.org/pcre.txt. In particular, see the
pcrepattern man page. However, make note of the
following:
Back-references are not allowed.
Recursive regular expressions are not
recommended.
The dot metacharacter also matches new lines.
The Unicode character set is not supported.
SET_TEXT_MODE(IGNORECASE)
overrides the “(?i)” internal option specified in
the regular expression.
The following are examples:
http.req.hostname.regex_match(re/
[[:alpha:]]+(abc){2,3}/)
http.req.url.set_text_
mode(urlencoded).regex_
match(re#(a*b+c*)#)
The following example matches ab and aB:
http.req.url.regex_match(re/a(?i)b/)
The following example matches ab, aB, Ab and
AB:
http.req.url.set_text_
mode(ignorecase).regex_match(re/ab/)
The following example performs a case-
insensitive, multiline match where the dot meta-
character also matches a new line:
http.req.body.regex_match(re/(?ixm)
(^ab (.*) cd$) /)
Operations That Apply Regular Expressions to Text and HTTP Headers
Regular Expression Operation Description