stefan1919

emailExtract

Oct 2nd, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System.Text;
  2. using System.Threading.Tasks;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace ConsoleApplication3
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             string input = Console.ReadLine();
  12.             string patternText = @"[A-Za-z.\d]+\@[A-Za-z]+\.[A-Za-z.]*(?=.|\s)";
  13.             string result = string.Empty;
  14.             Regex regexEmail = new Regex(patternText);
  15.             foreach (var item in regexEmail.Matches(input))
  16.             {
  17.                 Console.WriteLine(item);
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment