如abc@a.com;abcd@b.com;abcde@a.com ,结束不能是;号
这个正则表达式要如何写
9 个解决方案
#1
自己顶一下
大家帮帮忙啊
谢谢了
大家帮帮忙啊
谢谢了
#2
#!/usr/bin/perl
# get input
print “What\'s your email address?\n”;
$email = <STDIN>
chomp($email);
# match and display result
if($email =~ /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/)
{
print(“Your email address is correct!\n”);
}
else
{
print(“Please try again!\n”);
}
# get input
print “What\'s your email address?\n”;
$email = <STDIN>
chomp($email);
# match and display result
if($email =~ /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/)
{
print(“Your email address is correct!\n”);
}
else
{
print(“Please try again!\n”);
}
#3
JS版本
function verifyAddress(obj)
{
var email = obj.email.value;
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(flag)
{
alert(“Your email address is correct!”);
return true;
}
else
{
alert(“Please try again!”);
return false;
}
}
function verifyAddress(obj)
{
var email = obj.email.value;
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(flag)
{
alert(“Your email address is correct!”);
return true;
}
else
{
alert(“Please try again!”);
return false;
}
}
#4
split之后再单个验证~
#5
这样只能批配一个email地址,我想同时一次检查完所有的,比如输了两个地址
如:abc@a.com;abcd@a.com
如:abc@a.com;abcd@a.com
#6
如果分隔符固定的话,那就直接用split隔开为数组,一个个匹配。
#7
Expression:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
再用樓上的方法就行了!
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
再用樓上的方法就行了!
#8
"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"
#9
比如:一个EMail:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
多个Email用;号分开:
^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)(;(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*))*$
#1
自己顶一下
大家帮帮忙啊
谢谢了
大家帮帮忙啊
谢谢了
#2
#!/usr/bin/perl
# get input
print “What\'s your email address?\n”;
$email = <STDIN>
chomp($email);
# match and display result
if($email =~ /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/)
{
print(“Your email address is correct!\n”);
}
else
{
print(“Please try again!\n”);
}
# get input
print “What\'s your email address?\n”;
$email = <STDIN>
chomp($email);
# match and display result
if($email =~ /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/)
{
print(“Your email address is correct!\n”);
}
else
{
print(“Please try again!\n”);
}
#3
JS版本
function verifyAddress(obj)
{
var email = obj.email.value;
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(flag)
{
alert(“Your email address is correct!”);
return true;
}
else
{
alert(“Please try again!”);
return false;
}
}
function verifyAddress(obj)
{
var email = obj.email.value;
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(flag)
{
alert(“Your email address is correct!”);
return true;
}
else
{
alert(“Please try again!”);
return false;
}
}
#4
split之后再单个验证~
#5
这样只能批配一个email地址,我想同时一次检查完所有的,比如输了两个地址
如:abc@a.com;abcd@a.com
如:abc@a.com;abcd@a.com
#6
如果分隔符固定的话,那就直接用split隔开为数组,一个个匹配。
#7
Expression:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
再用樓上的方法就行了!
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
再用樓上的方法就行了!
#8
"^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"
#9
比如:一个EMail:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
多个Email用;号分开:
^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)(;(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*))*$