summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/regex-escape
blob: 4ab1e5b97e844fd5073387e79cf0ea46f73a30c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#
#  PRE: update if
#

#
#  Strings which are expanded in a regex have regex special
#  characters escaped.  Because the input strings are unsafe.
#
update request {
	Tmp-String-0 := "example.com"
	Tmp-String-1 := "exampleXcom"
}

if ("exampleXcom" =~ /%{Tmp-String-0}/) {
	update reply {
		Filter-Id := "fail 1"
	}
}

elsif (&Tmp-String-1 =~ /%{Tmp-String-0}/) {
	update reply {
		Filter-Id := "fail 2"
	}
}
else {
	update reply {
		Filter-Id := "filter"
	}
}