[OpenSIPS-Users] remove trailing white space

Liviu Chircu liviu at opensips.org
Tue Nov 11 19:13:47 CET 2014


On second thoughts, my regex is utterly broken if the vars contain SIP 
headers. This one will work much better:

avp_subst("$avp(str)", "/[\t ]+$//");

On 11/11/2014 08:07 PM, Liviu Chircu wrote:
> Hello Jeff,
>
> You could do something like:
>
> ...
> loadmodule "avpops.so"
> ...
> startup_route
> {
>     $var(str) = "foofoo      ";
>     $avp(str) = $var(str);
>     avp_subst("$avp(str)", "/([^ ]*) *$/\1/");
>     xlog("Replacement for '$var(str)' is '$avp(str)'\n");
> }
>
> Best regards,
> Liviu Chircu
> OpenSIPS Developer
> http://www.opensips-solutions.com
> On 11/11/2014 06:54 PM, Jeff Pyle wrote:
>> Hello,
>>
>> How might one remove trailing white space from a script variable or 
>> avp from within the OpenSIPS script?
>>
>>
>>
>> - Jeff
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20141111/510d5946/attachment.htm>


More information about the Users mailing list