blob: dab57a3a9fb106cb451c5f3457be42e1fdffbe3f (
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
|
# PRE: foreach if-regex-match
# This is what most people end up using foreach for,
# so we should probably test it works.
update request {
Tmp-String-0 := "cisco"
}
# Expanded regex
foreach Cisco-AVPair {
if ("%{Foreach-Variable-0}" =~ /^%{Tmp-String-0}=(.*)$/i) {
update reply {
Called-Station-Id += "%{1}"
}
}
}
# Compiled regex
foreach Cisco-AVPair {
if ("%{Foreach-Variable-0}" =~ /^stupid=(.*)$/i) {
update reply {
Called-Station-Id += "%{1}"
}
}
}
|