using uCalcSoftware; var uc = new uCalc(); var t = new uCalc.Transformer(); // Match two newlines in a row and replace with one t.FromTo("{@nl} {@nl}", "{@nl}"); string text = "First\n\nSecond\n\nThird"; Console.WriteLine(t.Transform(text));