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 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 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 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. 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! Link to comment https://forums.phpfreaks.com/topic/90781-telephone-regular-expression/#findComment-465365 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.