tqla Posted January 23, 2008 Share Posted January 23, 2008 I use this script to validate phone numbers. It works fine but the client wants to be able to accept a period (.) as well as a dash (-) between numbers. Where do I add the period? Thanks. /* check phone for invalid format. */ elseif ($field == "telephone" or $field == "mobile") { if(!ereg("^[0-9)( -]{7,20}(([xX]|(ext)|(ex))?[ -]?[0-9]{1,7})?$",$value)) { $bad_format[] = $field; Quote Link to comment https://forums.phpfreaks.com/topic/87423-solved-validation-question/ Share on other sites More sharing options...
The Little Guy Posted January 23, 2008 Share Posted January 23, 2008 Im thinking like this: <?php !ereg("^[0-9)( (-|\.)]{7,20}(([xX]|(ext)|(ex))?[ (-|\.)]?[0-9]{1,7})?$",$value) ?> Quote Link to comment https://forums.phpfreaks.com/topic/87423-solved-validation-question/#findComment-447186 Share on other sites More sharing options...
tqla Posted January 23, 2008 Author Share Posted January 23, 2008 Thanks. That works just fine! Quote Link to comment https://forums.phpfreaks.com/topic/87423-solved-validation-question/#findComment-447197 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.