[sr-dev] LCR/CR and prefix mask (REGEX?) [moved to SR-Users]
Iñaki Baz Castillo
ibc at aliax.net
Fri Jul 3 18:47:47 CEST 2009
El Viernes, 3 de Julio de 2009, Edson - Lists escribió:
> I looked around... CR uses the same approach that LCR on prefix
> definitions (or, at least the README don't say/explain that it's
> different). So I went to look on REGEX module...
>
> Iñaki, this module has Your signature... let me ask You what exactly are
> this REGEX groups? Could I use something like:
If the module doc is not self explanatory I should improve it :)
> - Use RURI and recover associated "REGEX-group number";
No, it's not the purpose. It let you matching a pv against any regular
expression in the group number passed as second parameter.
However you could get the desired behaviour as follows:
---- regex file ------------------------------
### National fixed numbers in Spain
[0]
^[89]\d{8}$
^(\+|00)34[89]\d{8}$
### National mobile numbers in Spain
[0]
^6\d{8}$
^(\+|00)346\d{8}$
### International numbers
[0]
^(\+|00)\d{8,}$
-------------------------------------------
Config file:
-----------------------------------------
if pcre_match_group("$rU", 0)
$var(group) = 0; # National fixed numbers in Spain
else if pcre_match_group("$rU", 1)
$var(group) = 1; # National mobile numbers in Spain
else if pcre_match_group("$rU", 2)
$var(group) = 2; # International numbers
[do something with $var(group)]
------------------------------------------
--
Iñaki Baz Castillo <ibc at aliax.net>
More information about the sr-dev
mailing list