What is the regular expression for International phone number validation in php or zend?
php, regex, zend-form, zend-framework
Solution
/^((\+|00)\d{1,3})?\d+$/
Try the above expression. hope this helps.
Problem
I have a zend form where I have a phone number field and have to check for validator. I have decided to use regular expression for that. I searched google but the results I have is not working. Can anyone please provide me the regular expression. here is my code: ``` $phone = new Zend_Form_Element_Text('phone'); $phone->setRequired(true); $phone->setLabel('Phone :') ->addFilter('StripTags') ->addValidator('NotEmpty', false, array('messages'=>'phone cannot be empty')) ->addFilter('StringTrim') ->addValidator('regex', false, array('/^[0-9 ]+$/','messages'=>'not a valid phone number')) ->addValidator('StringLength', false, array(5, 25, 'messages'=>'phone must be 5-25 character')) ``` Thanks in advance