using System.Text.RegularExpressions;
public static void Main()
string text = "Professor Aftab R Ala";
bool preserveTabs = false;
text = Regex.Replace(text, @" +", " ");
text = Regex.Replace(text, @" *\t *", "\t");
text = Regex.Replace(text, @"[ \t]+", " ");
text = Regex.Replace(text, @"([\t ]*(\n)+[\t ]*)+", "\n");
Console.Write("\nClean New Lines\n======\n" + text);