Hi Klaus,
regexp tries to do the longest match for each token so the (.*) will
include also the trailing spaces.
try not to put ., but everything except spaces, like [^ ]*
regards,
bogdan
Klaus Darilion wrote:
Norman Brandinger wrote:
> Hi Klaus,
>
> Below is a little test I put together to try to help you out:
>
> avp_write("<tel:+43108>", "$avp(s:pai)");
> avp_subst("$avp(s:pai)/$avp(s:cli)","/<tel\:(.*)>/\1/");
> xlog("L_NOTICE", "pai=$avp(s:pai) cli=$avp(s:cli)\n");
>
> This is the result:
>
> pai=<tel:+43108> cli=+43108
Hi Norman. Yes, you are right. I simply had a wrong regular
expression. But now I have another problem:
Input: $avp(s:pai) = '< tel:+43103 >'
(the part within '')
avp_subst("$avp(s:pai)/$avp(s:paias)","/.*<[[:blank:]]*(.*?)[[:blank:]]*>.*/\1/")
Output: $avp(s:paias) = 'tel:+43103 '
Thus, the leading whitespace is removed, but not the trailing one,
but I can't find an error in my regular expression. Maybe some
regexp experts out there?
thanks
klaus
>
> Regards,
> Norm
>
> Klaus Darilion wrote:
>
>> Hi!
>>
>> I have problems with avp_subst:
>>
>> I have $avp(s:pai) with the value <tel:+43108> (the < and >
>> belongs to the AVP)
>>
>> Then I want to extract the number into $avp(s:cli):
>>
>> avp_subst("$avp(s:pai)/$avp(s:cli)","/tel:(.*)/\1/")
>>
>> The result is <+43108>
>>
>> Can someone explain me why the leading < belongs to the result?
>> Shouldn't it be removed?
>>
>> thanks
>> klaus
>>
>> _______________________________________________
>> Users mailing list
>> Users(a)openser.org
>>
http://openser.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>
_______________________________________________
Users mailing list
Users(a)openser.org
http://openser.org/cgi-bin/mailman/listinfo/users