【发布时间】:2011-07-10 03:14:46
【问题描述】:
如何将以下正则表达式合并为一个以删除文件中的所有空格和句点?我想出了如何替换单个字符,而不是一行中的多个字符。
string testfile = @"C:\test\work\A Nightmare.On.Elm Street 1984.720p.BRRip.nfo";
testfile = testfile.Substring(0, testfile.Length - 4);
testfile = Regex.Replace(testfile, @"\.", "");
testfile = Regex.Replace(testfile, @"\s", "");
谢谢!
【问题讨论】:
-
testfile = testfile.Replace(".", "")