Also, if you know the length of the prefix you could just s.substr.

https://www.opensips.org/Documentation/Script-Tran-3-1#s.substr


Ben Newlin

From: Users <users-boun...@lists.opensips.org> on behalf of Liviu Chircu 
<li...@opensips.org>
Reply-To: OpenSIPS users mailling list <users@lists.opensips.org>
Date: Wednesday, July 29, 2020 at 9:15 AM
To: OpenSIPS users mailling list <users@lists.opensips.org>
Subject: Re: [OpenSIPS-Users] re.subst usage

On 29.07.2020 15:44, Barnaby Ritchley wrote:
With $rU of 12345441234567890 we would expect $var(to_user) to be 441234567890 
(stripping off the first 5 digits) however $var(to_user) returns 
12345441234567890

What am I doing wrong?


Hey Barnaby,

I would guess that the PCRE library does not support the "\d" literal, which 
also seems to be confirmed by this site [1].  The 
"/\+?[0-9]{5}([1-9][0-9]+)/\1/g" regexp should remove your tech prefix as 
expected.

BR,

[1]: 
https://www.regular-expressions.info/shorthand.html<https://www.regular-expressions.info/shorthand.html>

--

Liviu Chircu

www.twitter.com/liviuchircu<http://www.twitter.com/liviuchircu> | 
www.opensips-solutions.com<http://www.opensips-solutions.com>



OpenSIPS Summit 2020 Distributed

  
www.opensips.org/events/Summit-2020Distributed<http://www.opensips.org/events/Summit-2020Distributed>
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to