Debian Codegraph @

src/tests/keywords/foreach-regex

raw
1 # PRE: foreach if-regex-match
2
3 # This is what most people end up using foreach for,
4 # so we should probably test it works.
5 update request {
6 Tmp-String-0 := "cisco"
7 }
8
9 # Expanded regex
10 foreach Cisco-AVPair {
11 if ("%{Foreach-Variable-0}" =~ /^%{Tmp-String-0}=(.*)$/i) {
12 update reply {
13 Called-Station-Id += "%{1}"
14 }
15 }
16 }
17
18 # Compiled regex
19 foreach Cisco-AVPair {
20 if ("%{Foreach-Variable-0}" =~ /^stupid=(.*)$/i) {
21 update reply {
22 Called-Station-Id += "%{1}"
23 }
24 }
25 }
26