I want to validate phone numbers like follows using php.
+009411774132482 011 2560-205
试试这个'/^\\+?[0-9 \\-]+$/'
This should do it...
preg_match('/^\+?[\d -]+\z/', $str);
CodePad .
It will allow...
+
. 0-9
), space and -
. If you want a minimum amount, swap the +
with {9,}
. \\n
. 试试这个正则表达式:
^[\d\s+-]+$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.