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

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


2011/6/6 Daniel-Constantin Mierla <miconda at gmail.com>:
> one option that comes in my mind is to break it in several if conditions,
> matching one group at a time, written in the order of preferences.

The problem is that it would require perform N regular expression
matching and such expressions will be very long (all the country
prefixes in the world). The main problem is that some groups would
contain prefixes starting with, for example, 12, while in other group
there is the prefix 1 (an the very same in multiple cases, so doing it
manually would be too much manual work and any change in the world
would require hard modifications).

I'm evaluating building a custom function for this purpose.

Thanks.

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



More information about the sr-users mailing list