fork download
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. var s = "Hi this is Bob.";
  11. var results = Regex.Matches(s, @"(?=\b(\w+(?:[\s,]+\w+){2})\b)")
  12. .Cast<Match>()
  13. .Select(p => p.Groups[1].Value)
  14. .ToList();
  15. Console.WriteLine(String.Join(", ", results));
  16. }
  17. }
Success #stdin #stdout 0.11s 24416KB
stdin
Standard input is empty
stdout
Hi this is, this is Bob