Phone Format Preg_match Syntax
I have a preg_match question for my own site
==================================================================================
}
class Validate_Phone_Number {
var $error;
var $PMDR;
function __construct() {
$this->PMDR = Registry::getInstance();
}
function validate($value) {
if(preg_match(‘/^((+{0,1}d{1,3}(-| )?(?d)?(-| )?d{1,5})|((?d{2,6})?))(-| )?(d{3,4})(-| )?(d{4})(( x| ext)d{1,5}){0,1}$/’,$value) OR $value == ”) {
return true;
} else {
$this->error = ‘The phone number in the following field is incorrectly formatted: %s’;
return false;
}
}
}
==================================================================================
I want to have the verify/phone format to be only accepted if it meets one format style only!
the phone format I need must be = xxx xxx-xxxx / ext. xxxx (ext. not required, it is a option)
so it must be one of the two samples to approve the phone format or else fails
a). 800 555-1212
b). 800 555-1212 / ext.1234
AdSpace


