Debian Codegraph @

src/tests/keywords/regex-escape

raw
1 #
2 # PRE: update if
3 #
4
5 #
6 # Strings which are expanded in a regex have regex special
7 # characters escaped. Because the input strings are unsafe.
8 #
9 update request {
10 Tmp-String-0 := "example.com"
11 Tmp-String-1 := "exampleXcom"
12 }
13
14 if ("exampleXcom" =~ /%{Tmp-String-0}/) {
15 update reply {
16 Filter-Id := "fail 1"
17 }
18 }
19
20 elsif (&Tmp-String-1 =~ /%{Tmp-String-0}/) {
21 update reply {
22 Filter-Id := "fail 2"
23 }
24 }
25 else {
26 update reply {
27 Filter-Id := "filter"
28 }
29 }