Hello Iñaki,<div><br></div><div>I did this a long time ago using a db backend, i can&#39;t remember exactly how.</div><div><br></div><div>the table would be:</div><div><br></div><div>areacode, route</div><div>1                 route1</div>

<div>13               route2</div><div><br></div><div>I connected to mysql and ran something like:</div><div><br></div><div>select * from routes where &#39;$rU&#39; like concat(areacode,&#39;%&#39;) order by len(areacode) desc limit 1;</div>

<div><br></div><div><br></div><div>that works perfectly</div><div><br>hope it helps</div><div><br></div><div>David<br><div class="gmail_quote">On Mon, Jun 6, 2011 at 10:25 AM, 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;">Hi, I wonder how feasible is the folowing:<br>
<br>
I have a regular expresion like:<br>
<br>
  REGEXP = &quot;^((1|20)|(13|3|4)|(5|6))&quot;<br>
<br>
There are 3 matching groups:<br>
<br>
 1)   (1|20)<br>
 2)   (13|3|4)<br>
 3)   (5|6)<br>
<br>
I want to match the RURI user, let&#39;s suppose $rU = &quot;138787686223&quot;. In<br>
this case the above regexp matches groups 1 and 2, but since group 2<br>
matching is longest (&quot;13&quot; is longest than &quot;1&quot;) I want to get value 2.<br>
<br>
In case $rU = &quot;999999&quot; I need to get &quot;null&quot;, in case $rU =<br>
&quot;1000022323&quot; I need to get &quot;1&quot;.<br>
<br>
AFAIK there is no way to do it with current regular expression utils<br>
in Kamailio, but maybe I miss something. Thanks a lot.<br>
<font color="#888888"><br>
<br>
--<br>
Iñaki Baz Castillo<br>
&lt;<a href="mailto:ibc@aliax.net">ibc@aliax.net</a>&gt;<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</font></blockquote></div><br></div>