[OpenSIPS-Users] regular expression matching

2010-10-11 Thread Gabriel Bermudez
Hi everyone, I'm having trouble creating a regex in the opensips.cfg file.  This is the snipplet modparam("drouting", "attrs_avp", '$avp(s:dr_attrs)') ... do_routing(); $avp(s:special) = $(avp(s:dr_attrs){param.value,special}); xlog("attrs/$avp(s:dr_attrs) special/$avp(s:special) rU/$ru ^sip:$avp

[OpenSIPS-Users] Regular expression matching problem

2013-05-20 Thread Diego Barberio
Hi All, I'm having a really stupid issue with opensips 1.8.1. I need to do different logic if the request line user is a number of 4 digits that can be preceded by any character. So I created this regular expression: ^(.)?\d{4}$ I've tested it on www.regular-expressions.info/javascriptexample.html

[OpenSIPS-Users] regular expression matching question

2024-01-02 Thread Faheem Muhammad
Hi everyone, Firstly, I wish you all a Happy New Year with the best wishes for each community member and the OpenSIPS project. I have a question related to regular expressions matching in an IF condition. There are two identical regular expressions. One RE is matching and one RE is not matching t

Re: [OpenSIPS-Users] regular expression matching

2010-10-11 Thread Bogdan-Andrei Iancu
Hi Gabriel, when using regexp ops, you cannot use variables in the regexp definition. But your I miss your logic here - if you do routing based on prefixes (do_routing() ), why do you need an extra regexp checking for that rule ? if the Rule matches, you already know that RURI looks like "sip

Re: [OpenSIPS-Users] regular expression matching

2010-10-11 Thread Gabriel Bermudez
hi bodgan true, the problem is my voip provider, all calls must be delivered with a "pri prefix" at the begining, but local calls must be delivered without the E.164 prefix and I receive all my calls in E.164 so I must replace this prefix with another on, so for a local call. local call (593 E.16

Re: [OpenSIPS-Users] regular expression matching

2010-10-13 Thread Bogdan-Andrei Iancu
Hi Gabriel, why don't you use in DR 2 different rule with different "strip" and "pri_prefix" like: rule1: matches:00593 strips: 5 digits pri_prefix: "7424" rule2: matches:001 (or you can use default rule with empty matching prefix) strips: 0 digits pri_prefix: "7424" Th

Re: [OpenSIPS-Users] Regular expression matching problem

2013-05-20 Thread Bogdan-Andrei Iancu
Hi Diego, The REGEXPs in OpenSIPS are POSIX compliant, so \d are not supported. Try:"^(.)?[0-9]{4}$" . Regards, Bogdan-Andrei Iancu OpenSIPS Founder and Developer http://www.opensips-solutions.com On 05/20/2013 06:57 PM, Diego Barberio wrote: > Hi All, > > I'm having a really stupid issue with

Re: [OpenSIPS-Users] Regular expression matching problem

2013-05-20 Thread Muhammad Shahzad
OR to simplify more, you just want to match last four characters as digits, so you can try this as well, if ($rU =~ "[0-9]{4}$") { xlog("L_WARN", "> MATCHED << \n"); } else { xlog("L_WARN", ">>>

Re: [OpenSIPS-Users] regular expression matching question

2024-01-02 Thread Callum Guy
Hi Faheem, This is a simple case of regex support - I believe OpenSIPs uses Extended Regular Expressions and not Perl Compatible Regular Expressions. Swap out \d with the longer [0-9] format and your expression should match. Happy new year, Callum On Tue, 2 Jan 2024 at 11:27, Faheem Muhammad

Re: [OpenSIPS-Users] regular expression matching question

2024-01-03 Thread Michel crans
The reason why your second regular expression is not matching the pattern is because of a typo in the syntax. You have used the ~= operator instead of the =~ operator, which is the correct way to test if a string matches a regular expression in PCRE. Op di 2 jan 2024 om 12:28 schreef Faheem Muhamm

Re: [OpenSIPS-Users] regular expression matching question

2024-01-05 Thread Faheem Muhammad
Hi Machel, Appreciate the correction; it was a typo when I posted the question. However, as Callum mentioned earlier, the "IF" condition with the "=~" operator doesn't fully support PCRE. It seems that any regular expression with parentheses isn't matched using the "=~" operator. Using "pcre_match

Re: [OpenSIPS-Users] regular expression matching question

2024-01-23 Thread Bogdan-Andrei Iancu
Hi, check this https://opensips.org/html/docs/modules/3.4.x/regex.html Regards, Bogdan-Andrei Iancu OpenSIPS Founder and Developer https://www.opensips-solutions.com https://www.siphub.com On 05.01.2024 13:56, Faheem Muhammad wrote: Hi Machel, Appreciate the correction; it was a typo wh