Chapter 9 Advanced Expressions: String Sets, String Patterns, and Data Formats 169
Transforming Text and Numbers into Different Data Types
You can extract text or a number and treat it like another type of data. For
example, you can do the following:
Extract a string from an HTTP request body and treat it like an HTTP
header.
Extract a value from one type of request header and insert it in a response
header of a different type.
After typecasting the data, you can apply any operation that is appropriate for the
new data type. For example, if you typecast text to an HTTP header, you can
apply any operation that is applicable to HTTP headers to the returned value.
http header.REGEX_
SELECT(regular expression)Selects the text that matches the regular expression
argument in any instance of the http header value.
The header instances are matched from the last to
the first.
The following example selects "NS-CACHE-9.0:
90":
http.req.header("via").regex_
select(re!NS-CACHE-
\d\.\d:\s*\d{1,3}!)
Operations That Apply Regular Expressions to Text and HTTP Headers
Regular Expression Operation Description