fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Example
  5. {
  6. public static void Main()
  7. {
  8. string pattern = @"(\b|\s)(-{3})(\b|\s)";
  9. string input = @"This- -is - a test-sentence. -Test- --- One-Two--Three---Four----.";
  10.  
  11. foreach (Match m in Regex.Matches(input, pattern))
  12. {
  13. Console.WriteLine("'{0}' found at index {1}.", m.Groups[2].Value, m.Index);
  14. }
  15. }
  16. }
Success #stdin #stdout 0.08s 19912KB
stdin
Standard input is empty
stdout
'---' found at index 35.
'---' found at index 54.