Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace _1021___Extract_Emails
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string input = Console.ReadLine();
  11.  
  12. string pattern = @"(?<= )[A-Za-z0-9]+([\.|\-]\w*)?[^.-_]@\w+[\.|\-]+\w+[\.]*\w*[\.]*\w*\b";
  13. Regex regex = new Regex(pattern);
  14. MatchCollection matc = regex.Matches(input);
  15.  
  16. foreach (Match item in matc)
  17. {
  18. Console.WriteLine(item.Value);
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement