Regex Split on forward slash?

Peter Lambrechtsen peter at crypt.co.nz
Tue Dec 17 04:18:29 CET 2013


I'm trying to do a global split on a forward slash in FreeRadius 2.1.12.

Essentially I am trying to do a split on the ADSL Circuit ID:

ADSL-Agent-Circuit-Id = "POLT01 eth 1/1/02/05/4/14/1:10"

And trying to grab the value in the 6th split being "14" and check it's a
14.

I would have hoped something like this regex would work:

                if ("%{ADSL-Agent-Circuit-Id}" =~  /(?<=\/)([\w-]*)(?=\/)/
) {
                        update request {
                               Tmp-String-1 = "%{0}"
                               Tmp-String-2 = "%{1}"
                               Tmp-String-3 = "%{2}"
                               Tmp-String-4 = "%{3}"
                               Tmp-String-5 = "%{4}"
                               Tmp-String-6 = "%{5}"
                               Tmp-String-7 = "%{6}"
                        }
                }

And it would put each match into a Variable, or using /\//g too.

But neither option works.

Any suggestions on how to make it work, as I think taking it into Perl may
be the best option.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20131217/c8e8b641/attachment.html>


More information about the Freeradius-Users mailing list