<span class="Apple-style-span" style="border-collapse: collapse; ">Hello,<div><br></div><div>    I do not know why it did not dawn upon me to simply use the =~ operator.  However it does appear to error out / not compile:</div>
<div><br></div><div>&quot;(?i)(restricted|anonymous|private|unknown|unavailable)&quot;, i.e.</div><div><br></div><div>produces a runtime error:</div><div><br></div><div>if($hdr(From) =~ &quot;(?i)(restricted|anonymous|private|unknown|unavailable)&quot;){</div>
<div><br></div><div>}</div><div><br></div><div>* sending this to list.</div></span><br><div class="gmail_quote">On Thu, Sep 17, 2009 at 5:05 PM, Iñaki Baz Castillo <span dir="ltr">&lt;<a href="mailto:ibc@aliax.net">ibc@aliax.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">El Viernes, 18 de Septiembre de 2009, Brandon Armstead escribió:<br>
<div class="im">&gt; Hello,<br>
&gt;     I have the following pcre regex method call:<br>
&gt;<br>
&gt;     pcre_match(&quot;$hdr(From)&quot;, &quot;(?i)^(restricted|anonymous|private|unknown|<br>
unavailable)&quot;)<br>
&gt;<br>
&gt; to match calls that are sent without a proper ANI in a case-insensitive<br>
&gt; manner, however it does not seem to return true for the following example<br>
&gt; From Header:<br>
&gt;<br>
&gt; From Header: &quot;Unavailable&quot;<br>
</div>&gt; &lt;<a href="mailto:sip%3ARestricted@192.168.47.68">sip:Restricted@192.168.47.68</a>&lt;<a href="mailto:sip%253ARestricted@192.168.47.68">sip%3ARestricted@192.168.47.68</a>&gt;<br>
<div class="im">&gt;<br>
&gt; &gt;;tag=gK07327e23<br>
&gt;<br>
&gt; Any thoughts / input is appreciated, and as always thank you for your help!<br>
<br>
</div>You are using ^ symbol which means that the string MUST START by:<br>
<div class="im">  restricted|anonymous|private|unknown|unavailable<br>
<br>
</div>But your string $hdr(&quot;From&quot;) starts by &quot;Unavailable&quot; (*including* the<br>
quotation marks so it doesn&#39;t match).<br>
<br>
If the From URI username is enough (Restricted) you could do:<br>
<br>
  pcre_match(&quot;$dU&quot;, &quot;(?i)^(restricted|anonymous|private|unknown|<br>
  unavailable)&quot;)<br>
<br>
If you need to match the Display-Name (&quot;Unavailable&quot;) then you must add the<br>
quotation marks to the regular expression:<br>
<br>
  pcre_match(&quot;$fn&quot;, &quot;(?i)^(\&quot;)?(restricted|anonymous|private|unknown|<br>
  unavailable)(\&quot;)?&quot;)<br>
<br>
Note that I use $fn rather than $hdr(&quot;From&quot;), being $fn the From Display-Name:<br>
  <a href="http://kamailio.org/dokuwiki/doku.php/pseudovariables:1.5.x#from_display_name" target="_blank">http://kamailio.org/dokuwiki/doku.php/pseudovariables:1.5.x#from_display_name</a><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Iñaki Baz Castillo &lt;<a href="mailto:ibc@aliax.net">ibc@aliax.net</a>&gt;<br>
<br>
_______________________________________________<br>
Kamailio (OpenSER) - Users mailing list<br>
<a href="mailto:Users@lists.kamailio.org">Users@lists.kamailio.org</a><br>
<a href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.kamailio.org/cgi-bin/mailman/listinfo/users</a><br>
<a href="http://lists.openser-project.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.openser-project.org/cgi-bin/mailman/listinfo/users</a></font></blockquote></div><br>