best way to split by "," and interate?
Hi, I have a list update control { &Tmp-String-0 = "aa:bb:cc:dd:ee:ff,00:11:22:33:44:55,ff:ee:dd:cc:bb:aa" } And I would like to know about the best approach to split by "," and check if match with my ${Called-Station-Id} someone have a idea? -- Jorge Pereira
On Sep 16, 2015, at 12:39 PM, Jorge Pereira <jpereiran@gmail.com> wrote:
And I would like to know about the best approach to split by "," and check if match with my ${Called-Station-Id} someone have a idea?
Regular expressions. The servers string handling functions are pretty thin. Because it's not really designed to mangle strings. Alan DeKok.
On 16 Sep 2015, at 17:39, Jorge Pereira <jpereiran@gmail.com> wrote:
Hi,
I have a list
update control { &Tmp-String-0 = "aa:bb:cc:dd:ee:ff,00:11:22:33:44:55,ff:ee:dd:cc:bb:aa" }
And I would like to know about the best approach to split by "," and check if match with my ${Called-Station-Id} someone have a idea?
"%{explode:&Called-Station-ID ,}" foreach &Called-Station-ID { if ("%{Foreach-Variable-0}" =~ /expr/) { <stuff> } } Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
On 16 Sep 2015, at 17:54, Arran Cudbard-Bell <a.cudbardb@freeradius.org> wrote:
On 16 Sep 2015, at 17:39, Jorge Pereira <jpereiran@gmail.com> wrote:
Hi,
I have a list
update control { &Tmp-String-0 = "aa:bb:cc:dd:ee:ff,00:11:22:33:44:55,ff:ee:dd:cc:bb:aa" }
And I would like to know about the best approach to split by "," and check if match with my ${Called-Station-Id} someone have a idea?
"%{explode:&Called-Station-ID ,}"
foreach &Called-Station-ID { if ("%{Foreach-Variable-0}" =~ /expr/) { <stuff> } }
Ah, misread, but you get the idea... Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
participants (3)
-
Alan DeKok -
Arran Cudbard-Bell -
Jorge Pereira