[SR-Users] Using =~ to get the group identifier with longest match

Iñaki Baz Castillo ibc at aliax.net
Mon Jun 6 10:25:42 CEST 2011


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 at aliax.net>



More information about the sr-users mailing list