using System.Text; using System.Text.RegularExpressions; string text = Console.ReadLine(); string reg = @"^((([\w]+\.[\w]+)+)|([\w]+))@(([\w]+\.)+)([A-Za-z]{1,3})$"; if (Regex.IsMatch(text, reg)) { Console.WriteLine("Email."); } else { Console.WriteLine("Not email."); }
Output: |
---|
sakfkgfc@kfseg.cic |
asfllsfcn |
Not Email |