亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

How to write a regex in php to verify email and mobile phone number at the same time?
習(xí)慣沉默
習(xí)慣沉默 2017-05-16 13:06:44
0
3
823

php verifies email and mobile phone number at the same time

Need a regular expression that can match both mobile phone numbers and email accounts

習(xí)慣沉默
習(xí)慣沉默

reply all(3)
漂亮男人

First use /^[0-9]*$/ to determine whether it is a pure number. If it is, enter the logic of mobile phone number verification. Use /^1[3|4|5|7|8]d{9}$ / to verify whether it is a legal mobile phone number.

If it is not a pure number, enter the logic of email verification. /^w+((-w+)|(.w+))@[A-Za-z0-9]+((.|-)[A-Za- z0-9]+).[A-Za-z0-9]+$/ can be used to verify email

巴扎黑

Use this to verify the email address, and then when it returns false, use the regular pattern to verify the mobile phone number, like this.
$email = 'fengdingbo@gmail.com';
$result = filter_var($email, FILTER_VALIDATE_EMAIL);
var_dump($result); // string(20) "fengdingbo@gmail.com"

伊謝爾倫

It’s a bit loose to verify email and mobile phone number at the same time. You can take a look at the example below

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template