<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">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">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>