preg_match /有效的电子邮件地址 [英] preg_match / valid email address

查看:91
本文介绍了preg_match /有效的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些验证电子邮件地址的帮助。现在,我这样做:


函数sys_is_valid_email($ s){

if(preg_match(" /^.+@.+ \ .. + $ /",$ s)){

返回1;

}否则{

返回0;

}

}


效果很好,但开头不允许输入数字。

例如
2c***@forme.jom 无法输入
19 ** @ forme.jom 无法输入


但是,
co *** @forme.jom 可以输入
d19 **@forme.jom 可以输入


有人可以用preg_match帮我吗?


谢谢,
aaron

I need some help with validating an email address. Right now, I am doing this:

function sys_is_valid_email ($s) {
if (preg_match ("/^.+@.+\..+$/", $s)) {
return 1;
} else {
return 0;
}
}

It works great, but it doesn''t allow a number at the beginning.

For example
2c***@forme.jom can not be entered
19**@forme.jom can not be entered

but,
co***@forme.jom can be entered
d19**@forme.jom can be entered

Can someone help me with the preg_match?

Thanks,
aaron

推荐答案

s){

if(preg_match(" /^.+@。 + \ .. +
s) {
if (preg_match ("/^.+@.+\..+


/" ;,
/",


s)){

返回1;

} el se {

返回0;

}

}


效果很好,但它没有$ t
例如
2c *** @无法输入forme.jom
19**@forme.jom 无法输入


但是,
co***@forme.jom 可以输入
可以输入 d19**@forme.jom


有人可以帮助我使用preg_match吗?


谢谢,

aaron
s)) {
return 1;
} else {
return 0;
}
}

It works great, but it doesn''t allow a number at the beginning.

For example
2c***@forme.jom can not be entered
19**@forme.jom can not be entered

but,
co***@forme.jom can be entered
d19**@forme.jom can be entered

Can someone help me with the preg_match?

Thanks,
aaron


这篇关于preg_match /有效的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆