Hello Iñaki,

I did this a long time ago using a db backend, i can't remember exactly how.

the table would be:

areacode, route
1                 route1
13               route2

I connected to mysql and ran something like:

select * from routes where '$rU' like concat(areacode,'%') order by len(areacode) desc limit 1;


that works perfectly

hope it helps

David
On Mon, Jun 6, 2011 at 10:25 AM, Iñaki Baz Castillo <ibc@aliax.net> wrote:
Hi, I wonder how feasible is the folowing:

I have a regular expresion like:

 REGEXP = "^((1|20)|(13|3|4)|(5|6))"

There are 3 matching groups:

 1)   (1|20)
 2)   (13|3|4)
 3)   (5|6)

I want to match the RURI user, let's suppose $rU = "138787686223". In
this case the above regexp matches groups 1 and 2, but since group 2
matching is longest ("13" is longest than "1") I want to get value 2.

In case $rU = "999999" I need to get "null", in case $rU =
"1000022323" I need to get "1".

AFAIK there is no way to do it with current regular expression utils
in Kamailio, but maybe I miss something. Thanks a lot.


--
Iñaki Baz Castillo
<ibc@aliax.net>

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users