using System; using System.Linq; using System.Text.RegularExpressions; public class Test { public static void Main() { var s = "This- -is - a test-sentence. -Test- --- One-Two--Three---Four----."; var result = Regex.Replace(s, @"\b(-+)\b|-", "$1"); Console.WriteLine(result); } }