I think my keyboard battery is failing, it keeps dropping characters… Here’s a better
example.
$var(data) = $(rb{re.subst,/^rate is ([0-9]+).*$/\1/});
Regards,
Hugh
From: sr-users-bounces(a)lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org]
On Behalf Of Waite, Hugh
Sent: 15 August 2014 10:43
To: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] Text Operations on a Message
Hi,
The re.subst transformation can be used on variables to extract data.
http://www.kamailio.org/wiki/cookbooks/devel/transformations#resubst_expres…
$rb is the variable that contains the request body, but you can use $var or $avp variables
if doing multiple operations.
$var(data) = (int)$(rb{re.subst,/^rate is ([0-9+).*$/\1});
Regards,
Hugh
From:
sr-users-bounces@lists.sip-router.org<mailto:sr-users-bounces@lists.sip-router.org>
[mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of AliReza Khoshgoftar Monfared
Sent: 14 August 2014 20:00
To: Kamailio (SER) - Users Mailing List
Subject: [SR-Users] Text Operations on a Message
Hi list,
How can I extract a specific part of my message body?
I know that "textops" has the function "search_body(re)" but it
returns True/False upon finding "re" in the body of the text, how can I return
the actual text that regular expression matches?
As an example, my message body is
rate is 172#012
I want to extract the number "172" out of this.
Thanks
Alireza
________________________________
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal
privilege. It should not be copied, disclosed to, retained or used by, any other party. If
you are not an intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you for understanding.
________________________________
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal
privilege. It should not be copied, disclosed to, retained or used by, any other party. If
you are not an intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you for understanding.