c#中如何用代码验证是否电子邮件(用正则)

发表于:2007-06-30来源:作者:点击数: 标签:
1.引用名称空间
using System.Text.RegularExpressions;
2.代码:

string strInput="[email protected]";
string strExp=@"w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*"
// Create a new Regex object.
Regex r = new Regex(strExp);
// Find a single match in the string.
Match m = r.Match(strInput);
if (m.Suclearcase/" target="_blank" >ccess)
{
MessageBox.Show("验证成功!");
}

原文转自:http://www.ltesting.net