strange regex question

Xin knightluffy at live.com
Wed Oct 8 15:46:58 CEST 2014


I have found my mistake, it should be \\\\ not \\ :)

-----Original Message-----
From: freeradius-users-bounces+knightluffy=live.com at lists.freeradius.org
[mailto:freeradius-users-bounces+knightluffy=live.com at lists.freeradius.org]
On Behalf Of Xin
Sent: Wednesday, October 08, 2014 9:43 PM
To: 'FreeRadius users mailing list'
Subject: strange regex question

Hi Alan Dekok,

I'm looking your reply on:
http://lists.freeradius.org/pipermail/freeradius-users/2008-April/027737.htm
l
And I found you give an example as the following below:
> 	e.g. for : DOMAIN\randy.hall
> 
> 	if (User-Name =~ /^DOMAIN\\(.*)/) {
> 		update request {
> 			Stripped-User-Name := "%{1}"
> 		}
> 	}

But it fails in my case:
rad_recv: Access-Request packet from host my_ip port 56949, id=250, le
ngth=175
        User-Name = "Windows Phone\\test"
        NAS-Port-Type = Virtual
        ....
# Executing section authorize from file
/usr/local/etc/raddb/sites-enabled/defau
lt
+group authorize {
++? if (User-Name =~ /Windows Phone\\(.*)/)
? Evaluating (User-Name =~ /Windows Phone\\(.*)/) -> FALSE
++? if (User-Name =~ /Windows Phone\\(.*)/) -> FALSE

I really don't know why it fails.

I have tested my case in RegexBuddy, and it worked in POSIX ERE, but POSIX
BRE failed.
My FreeRadius version is 2.2.5. 
Appreciate for your help.
-
List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list