using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"(\b|\s)(-{3})(\b|\s)"; string input = @"This- -is - a test-sentence. -Test- --- One-Two--Three---Four----."; foreach (Match m in Regex.Matches(input, pattern)) { Console.WriteLine("'{0}' found at index {1}.", m.Groups[2].Value, m.Index); } } }