string src=File.ReadAllText("test.txt"); src=Regex.Replace(src,@"(/s+/r)+",delegate(Match m) {return "/r";}); File.WriteAllText("test.txt",src); 记录下~