using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
Console.Write("Enter an email: ");
string email = Console.ReadLine();
string pattern = @"^[^@\s]+@[^@\s]+\.[^@\s]+$";
if (Regex.IsMatch(email, pattern))
Console.WriteLine("Email is in proper format.");
else
Console.WriteLine("Email is NOT in proper format.");
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter