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; 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) ?> 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! Link to comment https://forums.phpfreaks.com/topic/87423-solved-validation-question/#findComment-447197 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.