验证邮箱格式
class Program
{
static void Main(string[] args)
{
string s = "1033628976@qq.com";
if (Yzmail(s) == true)
{
Console.WriteLine("邮箱格式正确!");
}
else
{
Console.WriteLine("邮箱格式错误!");
}
}
public static bool Yzmail(string s)
{
Regex regex = new Regex(@"^[\w-.]+@([\w-]+\.)+[\w]{2,4}$");
return regex.IsMatch(s);
}
}
浙公网安备 33010602011771号