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

Henning Westerholt henning.westerholt at 1und1.de
Mon Jun 6 12:47:34 CEST 2011


On Monday 06 June 2011, Iñaki Baz Castillo wrote:
> [..]
> 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.

Hi Iñaki,

if you just want to have the longest match on a prefix tree, this is what 
carrierroute was build for.
 
> In case $rU = "999999" I need to get "null", in case $rU =
> "1000022323" I need to get "1".

Its works a bit differently, but this is similar to the logic that we use. 
You've a bunch of specific prefixes with special routing, normal country 
prefixes that you want to route differently and then a default routing for the 
rest.

Best regards,

Henning



More information about the sr-users mailing list