Citrix Systems Network Router 9.2 User Manual

Page of 302
166
Citrix NetScaler Policy Configuration and Reference Guide
The following table describes operations that use regular expressions.
Operations That Apply Regular Expressions to Text and HTTP Headers
Regular Expression Operation
Description
text.BEFORE_REGEX(regular 
expression)
Selects text that precedes the string that matches 
the regular expression argument. If the regular 
expression
 does not match any data in the target, 
the expression returns a text object of length of 0.
The following expression selects the string "text" 
from "text/plain".
http.res.header("content-
type").before_regex(re#/#) 
text.AFTER_REGEX(regular 
expression)
Selects text that follows the string that matches the 
regular expression argument. If the regular 
expression does not match any text in the target, 
the expression returns a text object of length of 0.
The following expression extracts "Example" from 
"myExample":
http.req.header("etag").after_
regex(re/my/)
text.REGEX_SELECT(regular 
expression)
Selects a string that matches the regular expression 
argument. If the regular expression does not match 
the target, a text object of length of 0 is returned.
The following example extracts the string "NS-
CACHE-9.0: 90" from a Via header:
http.req.header("via").regex_
select(re!NS-CACHE-
\d\.\d:\s*\d{1,3}!)