fork(1) 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 text = "One word, duel. Limes said bye.";
  12. var pattern = @"\b(?<w>\p{L}+)(?:\P{L}+(?<w>(\p{L})(?<=\1\P{L}+\1)\p{L}*))+\b";
  13. var result = Regex.Match(text, pattern, RegexOptions.IgnoreCase)?.Groups["w"].Captures
  14. .Cast<Capture>()
  15. .Select(x => x.Value);
  16. Console.WriteLine(string.Join(", ", result));
  17. }
  18. }
  19.  
Success #stdin #stdout 0.08s 22048KB
stdin
Standard input is empty
stdout
word, duel, Limes, said