
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