Personally I am a student of Occam's razor.
Hi,what of25407299748020729-974-8020729 974 802254 0729 974 802I may have repeated some yours - but looking at your code, am sure it would capture these too.. :)-AlexOn Sun, Jul 24, 2011 at 10:10 PM, Michael Pedersen <sku@kaal.dk> wrote:
Hi everyone,
I'm trying to create some code to validate/sanitize mobile phone numbers entered by users, for use with SMS gateways.
So far I have the following:
729974802 becomes: 254729974802
0729974802 becomes: 254729974802
0 729 974 802 becomes: 254729974802
254 729974802 becomes: 254729974802
+254 729974802 becomes: 254729974802
(254) 7 29974802 becomes: 254729974802
+(254) 7 29974802 becomes: 254729974802
(+254) (0) 7 29974802 becomes: 254729974802
However I am not sure that I have captured all the different ways that a Kenyan mobile-phone number could be entered.
So the question to you all is: are there more ways a number could be entered ?
n.b. if anyone is interested the code for the above is (in php):
$phone = '254' . preg_replace('/^\+?(\(?\+?254\)?)?(\(?0\)?)?7/', '7', str_replace(' ', '', $input));
..
Mike
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke