On 17 Dec 2013, at 03:18, Peter Lambrechtsen <peter@crypt.co.nz> wrote:
I'm trying to do a global split on a forward slash in FreeRadius 2.1.12.
g is not currently supported in any version of FreeRADIUS. You are limited to 8 capture groups.
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.
No, g won't work. You probably need \\/ because of the multiple levels of escaping...
Any suggestions on how to make it work, as I think taking it into Perl may be the best option.
Sure, but there will be a significant performance hit, and as (presumably) your company is an ISP that may be an issue Additionally by default the regular expression flavour is extended regular expressions, though PCRE is supported in 3.x.x if you have the PCRE library available at build time. -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2