求一个多邮件验证 需要一个验证..一个文本框可以不输入,或者输入单个或者多个邮件.当输入多个邮件的时候用";"隔开. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 split成数组,然后循环判断 if(this.textbox.Text.Contains(',')){ //输入错误不能包含,}else if(this.textbox.Text.Contains(';')){ //多个邮箱地址用string [] arr= split(';')接受再循环遍历} http://huanghao5668.blog.163.com/blog/static/20561202200710713630277/ 我觉得应该用正则Validator。不知道正则专家们有没有好办法。 看看这里有没有能用的。http://regexlib.com/DisplayPatterns.aspx在页面里面搜multiple string pattern = @"(?im)(([a-zA-Z0-9]+[_.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}[;;]?)*"; string text=this.textBox1.Text.Trim(); if (Regex.IsMatch(text, pattern)) { MessageBox.Show("输入正确"); } public static void GetA3() { string str = "[email protected];[email protected]"; Regex regex = new Regex(@"^(\w[A-Za-z\d]+@[\d\w]+(.[\d\w])+[;;]?)+$"); Console.WriteLine(regex.IsMatch(str)); } 正則 (^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[;])+$||^\S*$(^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[;])+驗證一條或多條Email^\S*驗證空 【求助】:关于内网A平台与B平台登陆问题 asp.net 程序中 前台javascript 二维数组问题 ImageButton dropdownlist覆盖问题 怎样生成和产生一个静态页面阿? 模板列的问题,高手请进!!! 请问框架怎么拖动? 我的网站全是htm文件,我想让用户认证后才能访问,不知有什么办法? 安装visual studio.net 遇到的麻烦(急) 怎样绕过防火墙取远程数据中的数据(请思归等大侠们帮忙) 求一个可以把图片上传到服务器指定路径的html编辑器或代码 .NET项目发布后,报表部分的rdlc文件,以及根目录下的xsd文件不见了
然后循环判断
{
//输入错误不能包含,
}
else if(this.textbox.Text.Contains(';'))
{
//多个邮箱地址用string [] arr= split(';')接受再循环遍历
}
不知道正则专家们有没有好办法。
http://regexlib.com/DisplayPatterns.aspx在页面里面搜multiple
string text=this.textBox1.Text.Trim();
if (Regex.IsMatch(text, pattern))
{
MessageBox.Show("输入正确");
}
{
string str = "[email protected];[email protected]";
Regex regex = new Regex(@"^(\w[A-Za-z\d]+@[\d\w]+(.[\d\w])+[;;]?)+$");
Console.WriteLine(regex.IsMatch(str));
}
(^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[;])+$||^\S*$(^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[;])+驗證一條或多條Email
^\S*驗證空