168 Citrix NetScaler Policy Configuration and Reference Guide

Operations That Apply Regular Expressions to Text and HTTP Headers

Regular Expression Operation

Description

 

 

http header.AFTER_

Evaluates all instances of the header and extracts

REGEX(regular expression)

the text following the string that matches the

 

regular expression argument in any instance of the

 

header value. The header instances are matched

 

from the last to the first.

 

The following example extracts "BBCCDD" from

 

"AABBCCDD".

 

http.req.header("etag").after_

 

regex(re/AA/)

http header.BEFORE_

For any instance of the header, this operation

REGEX(regular expression)

returns the text that precedes the string matching

 

the regular expression argument. The header

 

instances are evaluated from the last to the first.

 

The following example extracts "text" from "text/

 

plain":

 

http.res.header("content-

 

type").before_regex(re#/#)

http header.REGEX_

This operation returns a Boolean TRUE if the

MATCH(regular expression)

regular expression argument matches any instance

 

of the header value. The header instances are

 

evaluated from the last to the first.

 

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 the strings “ab”

 

and “aB”:

 

http.req.url.regex_match(re/a(?i)b/)

 

The following example matches the strings “ab”,

 

“aB”, “Ab”, and “AB”:

 

http.req.url.set_text_

 

mode(ignorecase).regex_match(re/ab/)

 

The following example performs a case-

 

insensitive, multi-line match, where the dot (.)

 

meta-character also matches a new line:

 

http.req.body.regex_match(re/(?ixm)

 

(^ab (.*) cd$) /)

Page 182
Image 182
Citrix Systems 9.2 manual Text following the string that matches, Header value. The header instances are matched, Plain