Advertisement
halleman19

email valitor | regex | c#

Feb 18th, 2025
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | Source Code | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace avstn.mail
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Console.Title = "Email validtor";
  11.  
  12.             string pattern = @"^([a-z0-9\.\-]{3,20})\@([a-z]{1,10})\.([a-z]{2,10})$";
  13.  
  14.             Regex reg = new Regex(pattern, RegexOptions.ExplicitCapture);
  15.  
  16.             string email;
  17.  
  18.             do
  19.             {
  20.                 email = Console.ReadLine();
  21.  
  22.                 if (email == string.Empty)
  23.                     continue;
  24.  
  25.                 Console.WriteLine(string.Format("Validaty check: {0} \n\n", reg.IsMatch(email)));
  26.             }
  27.             while (email != "/q");
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement