using System.Text.RegularExpressions;
public static void Main()
var EmailId1="test@gmail.com";
var EmailId2= "test1212@com";
string pattern = @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z";
if (Regex.IsMatch(EmailId1 , pattern))
Console.WriteLine(EmailId1+ " is a valid Email address ");
Console.WriteLine(EmailId1 + " is not a valid Email address");
if (Regex.IsMatch(EmailId2 , pattern))
Console.WriteLine(EmailId2+ " is Valid Email address ");
Console.WriteLine(EmailId2 + " is Not a Valid Email address");