Ell20 Posted February 12, 2008 Share Posted February 12, 2008 Hi, Im attempting to make a regular expression to check that the data input is a valid telephone number. Im looking to accept telephone numbers in either of these formats: +447973886123 or +4407973886123 or 07973886123 I have had ago but dont think its working correctly: if (eregi ("[a-z0-9\+]{11,14}", stripslashes(trim($_POST['contact_number'])))) { Appreciate any help Quote Link to comment https://forums.phpfreaks.com/topic/90781-telephone-regular-expression/ Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 You can probably find an example here http://www.phpfreaks.com/forums/index.php/topic,96280.0.html Quote Link to comment https://forums.phpfreaks.com/topic/90781-telephone-regular-expression/#findComment-465344 Share on other sites More sharing options...
Ell20 Posted February 12, 2008 Author Share Posted February 12, 2008 I have found one which is very simular and supposed to match what I am looking to match however it dosent actually work. (((\+44)? ?(\(0\))? ?)|(0))( ?[0-9]{3,4}){3} Could the reason it dosent work be that its coded for a different language? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/90781-telephone-regular-expression/#findComment-465349 Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 You would probably get a better answer in the REGEX forum. Quote Link to comment https://forums.phpfreaks.com/topic/90781-telephone-regular-expression/#findComment-465353 Share on other sites More sharing options...
Ell20 Posted February 12, 2008 Author Share Posted February 12, 2008 Thanks ill try there, didnt realise there was such a forum! Quote Link to comment https://forums.phpfreaks.com/topic/90781-telephone-regular-expression/#findComment-465365 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.