C
HAPTER
9
Advanced Expressions: String Sets, String Patterns, and Data Formats
You can configure an operation that matches text in a target against a set of
strings (an array) or a single string within an array. You can also match a target
against a pattern defined in a regular expression. You can use a regular expression
to specify wildcard characters in a pattern, such as text, numbers, and spaces.
Finally, you can use typecasting to convert one type of data into another type. For
example, you can extract a string from an HTTP request POST body and format it
as an HTTP header for the purpose of inserting the header into an HTTP
response.
In This Chapter
Matching Text With Strings in a Set
Matching Text With a Pattern
Transforming Text and Numbers into Different Data Types

Matching Text With Strings in a Set

A pattern set compares a target with multiple static strings. A pattern set can be
efficient if an expression would otherwise have a large number of Boolean OR
operations. A pattern set reduces the overhead that would be required to process
the ORs.
For example, you can define a pattern set with the strings “host1” and “host2”,
“host3” and compare the target against each string. You can also compare the
target with just one particular string in the set. For example, you can define a
pattern set with the strings “vserver1”, “vserver2”, vserver3” and compare the
target against only the string “vserver1”. For this type of comparison, you specify
a unique index that is assigned to each string in the pattern set.
You can use a pattern set in any expression that evaluates HTTP headers or text.
For information about expression prefixes for HTTP headers, see “Expressions
for HTTP Headers,” on page 115. For information about expression prefixes for
text, see “Expression Prefixes for Text,” on page 67.