You can use regular expression sub-captures.
if (User-Name =~ /^mppp%(.+)$/){
update request {
User-Name := "%{1}"
}
}
Insert it before the call to the SQL module
-Arran
On May 16, 2011, at 1:58 PM, Steve Staples wrote:
> Hi all,
>
> I am looking to replace a string, before sending the query off to sql...
>
> right now, it is %{SQL-User-Name} (sql_user_name = "%{User-Name}"
> ), but the value is going to be like:
> mppp%[email protected]
>
> and i want to remove the mppp% (which will always be prefixed, or not
> exist) so that the variable only is
> [email protected]
>
> Is that easy to do? I have searched the docs, but came up empty (sorry
> if it has been discussed already... just didnt find it)
>
> I could always write it in the query to replace the string:
> SELECT REPLACE('mppps%[email protected]', 'mppp%', '');
> but not sure if that is the most efficient way to do it?
>
> Thanks in advance.
>
> Steve.
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Arran Cudbard-Bell
RM-RF Limited - Security consultation and contracting
VoIP: +1 916-436-1352 Cell: +44 7854041841
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html