fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var s = @"Text user1@company.com here user2@company.com and user3@company.com here user1@private.com more user2@private.com";
  12. var result = s.Split().Where(m =>
  13. Regex.IsMatch(m, @"^\S+@\S+\.\S+$") && m != "user2@private.com" && !m.StartsWith("user1@"));
  14. foreach (var str in result)
  15. Console.WriteLine(str);
  16. }
  17. }
Success #stdin #stdout 0.04s 134208KB
stdin
Standard input is empty
stdout
user2@company.com
user3@company.com