Match newline in Cisco-AVPair[*]

Kostas Zorbadelos kzorba at
Fri Apr 17 15:47:36 CEST 2015

Phil Mayers <p.mayers at> writes:

>>>> On Apr 15, 2015, at 9:29 AM, Kostas Zorbadelos <kzorba at> wrote:
>>>>> I am trying to perform a match against the full Cisco-AVPair string
>>>>> (Cisco-AVPair[*]) to get a specific part. The exact check I am
>>>>> performing is
>>>>   It would be better to loop over the Cisco-AVPairs with a
>>>>   "foreach", and the match the one you want. 
>> the way I see it, I cannot do a "foreach" in unlang. I would need to
> Yes you can. It was added in the 3.x series.

I understood that the required functionality exists in the 3.x series,
so at some time I will need to upgrade. Running 2.2.x now, this is
something I should have mentioned from the very beginning. 
As a workaround, until I upgrade, I performed a workaround in my regex,

"%{Cisco-AVPair[*]}" =~ /client-mac-address=(.{14})/

works as expected in my case and matches the information just before the
\n (not including it). Not the "best" solution but works for now.

Thanks everyone for the valuable input.



More information about the Freeradius-Users mailing list