limonchesled

ExtractEmails

Oct 29th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace _1.ExtractEmails
  5. {
  6.     class ExtractEmails
  7.     {
  8.         static void Main()
  9.         {
  10.             string pattern = @"(\b\w+\.?\w+)@(\w+.\w+\.?\w+)";
  11.             string input = Console.ReadLine();
  12.  
  13.             foreach (Match m in Regex.Matches(input, pattern))
  14.             {
  15.                 Console.WriteLine(m.Value);
  16.             }
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment