<div dir="ltr">OR to simplify more, you just want to match last four characters as digits, so you can try this as well,<div><br></div><div><div>                if ($rU =~ &quot;[0-9]{4}$&quot;) {</div><div>                        xlog(&quot;L_WARN&quot;, &quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; MATCHED &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; \n&quot;);</div>

<div>                } else {</div><div>                        xlog(&quot;L_WARN&quot;, &quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; NOT MATCHED &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; \n&quot;);</div>

<div>                }</div></div><div><br></div><div style>Thank you.</div><div style><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 20, 2013 at 6:41 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div text="#000000" bgcolor="#ffffff">
    <tt>Hi Diego,<br>
      <br>
      The REGEXPs in OpenSIPS are POSIX compliant, so \d are not
      supported. Try:<span style="font-family:courier new,monospace">
        &quot;^(.)?[0-9]{4}$</span>&quot; .<br>
    </tt><tt><br>
      Regards,<br>
    </tt>
    <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre><div><div class="h5">
    <br>
    On 05/20/2013 06:57 PM, Diego Barberio wrote:
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi All,<br>
                <br>
              </div>
              I&#39;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}$<br>
            </div>
            I&#39;ve tested it on <a href="http://www.regular-expressions.info/javascriptexample.html" target="_blank">www.regular-expressions.info/javascriptexample.html</a>
            and works perfect, however on opensips it never matches.<br>
            <br>
          </div>
          I&#39;ve made the following test script:<br>
          <br>
          <span style="font-family:courier new,monospace"><br>
                    if($rU =~ &#39;^(.)?\d{4}$&#39;) {<br>
                            xlog(&quot;MATCHES $rU\n&quot;);<br>
                    }else{<br>
                            xlog(&quot;NOT MATCHES $rU\n&quot;);<br>
                    }</span><br>
          <br>
        </div>
        And I always get &quot;NOT MATCHES&quot;:<br>
        <span style="font-family:courier new,monospace"><br>
          May 20 11:54:33 localhost /usr/local/sbin/opensips[22628]: NOT
          MATCHES *5522 <br>
          May 20 11:54:42 localhost /usr/local/sbin/opensips[22629]: NOT
          MATCHES 5522 </span><br>
        <div>
          <div><br>
          </div>
          <div>What am I doing wrong?<br>
            <br>
          </div>
          <div>Thanks<br>
          </div>
          <div>Diego<br>
          </div>
          <div><br>
          </div>
        </div>
      </div>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </div>

<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Mit freundlichen Grüßen</span></div>

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Muhammad Shahzad</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">------------------------------</span><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">-----</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">CISCO Rich Media Communication Specialist (CRMCS)</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">CISCO Certified Network Associate (CCNA)</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Cell: +49 176 99 83 10 85</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">MSN: </span><a href="mailto:shari_786pk@hotmail.com" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)" target="_blank">shari_786pk@hotmail.com</a><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Email: </span><a href="mailto:shaheryarkh@googlemail.com" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)" target="_blank">shaheryarkh@googlemail.com</a>
</div>