Advertisement
Guest User

01. Extract Emails

a guest
Jun 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _5.Magic_exchangeable_words
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. string patter = @"[A-Za-z.-0-9._]+@[A-Za-z.-]+[A-Za-z]+\.-?\w+";
  15.  
  16. Regex regex = new Regex(patter);
  17.  
  18. string text = Console.ReadLine();
  19.  
  20. MatchCollection matches = regex.Matches(text);
  21.  
  22. foreach (Match match in matches)
  23. {
  24. Console.WriteLine(match);
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement