<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<font face="monospace">Hi,<br>
<br>
check this <a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/3.4.x/regex.html">https://opensips.org/html/docs/modules/3.4.x/regex.html</a><br>
<br>
Regards,<br>
</font>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
<a class="moz-txt-link-freetext" href="https://www.siphub.com">https://www.siphub.com</a></pre>
<div class="moz-cite-prefix">On 05.01.2024 13:56, Faheem Muhammad
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CA++nn_xKt7rW5CakGw1LBq5s0iurshZysg1FAjHayJ0JhE8=_A@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi Machel,<br>
<br>
<div>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. </div>
<div>Using "pcre_match" or an alternative regular expression
would be more suitable in this case.</div>
<div><br>
</div>
<div>Thank you</div>
<div>M. Faheem<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Jan 3, 2024 at 6:37 PM
Michel crans <<a href="mailto:mcrans@gmail.com"
moz-do-not-send="true" class="moz-txt-link-freetext">mcrans@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<p
style="padding:0px;margin:12px 0px 0px;word-break:break-word;font-size:16px;color:rgb(17,17,17);font-family:-apple-system,Roboto,SegoeUI,"Segoe UI","Helvetica Neue",Helvetica,"Microsoft YaHei","Meiryo UI",Meiryo,"Arial Unicode MS",sans-serif;background-color:rgba(255,255,255,0.7)"><br>
</p>
<p
style="padding:0px;margin:12px 0px 0px;word-break:break-word;font-size:16px;color:rgb(17,17,17);font-family:-apple-system,Roboto,SegoeUI,"Segoe UI","Helvetica Neue",Helvetica,"Microsoft YaHei","Meiryo UI",Meiryo,"Arial Unicode MS",sans-serif;background-color:rgba(255,255,255,0.7)">The
reason why your second regular expression is not matching
the pattern is because of a typo in the syntax. You have
used the <code
style="margin:0px 2px;padding:1px 4px;box-sizing:border-box">~=</code> operator
instead of the <code
style="margin:0px 2px;padding:1px 4px;box-sizing:border-box">=~</code> operator,
which is the correct way to test if a string matches a
regular expression in PCRE.</p>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Op di 2 jan 2024 om 12:28
schreef Faheem Muhammad <<a
href="mailto:faheem2084@gmail.com" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">faheem2084@gmail.com</a>>:<br>
</div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Hi everyone, <br>
</div>
<div>
<p>Firstly, I wish you all a Happy New Year with the
best wishes for each community member and the
OpenSIPS project.</p>
</div>
<div><br>
</div>
<div>I have a question related to regular expressions
matching in an IF condition. </div>
<div>There are two identical regular expressions. One RE
is matching and one RE is not matching the pattern. <br>
</div>
<div><br>
</div>
<div><b>Sample $fU Range: </b>+966123456700 to
+96612345650<br>
</div>
<div><br>
</div>
<div><span style="color:rgb(106,168,79)"># RE1 -
Matching Regular expression</span><br>
</div>
<div>if($fU =~"\+9661234567[0-4][0-9]|\+966123456750"){<br>
xlog("re matched\n")<br>
}<br>
<br>
<span style="color:rgb(255,0,0)"># RE2 - Non matching
Regular expression</span><br>
if($fU ~="\+9661234567([0-4]\d|50)"){<br>
} # RE not matched</div>
<div><br>
</div>
<div>Can anyone please suggest what I'm doing wrong?<br>
</div>
<div><br>
</div>
<div><b>OpenSIPS version</b>: 3.2.3 <br>
</div>
<div>OS: <b>Debian 12</b><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Best regards,</div>
<div>M. Faheem<br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">Users@lists.opensips.org</a><br>
<a
href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">Users@lists.opensips.org</a><br>
<a
href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>