这是我在文本文件中的行。我想使用正则表达式从我的文本文件中删除这一行。
---------- RECOMMENDATION 1 OF 3 IN GROUP 1 (USD 168.90)----------
我正在尝试这段代码,但它给出了错误。
StreamReader sreader = File.OpenText(@"C:\FareSearchRegex.txt");
string line;
while ((line = sreader.ReadLine()) != null)
{
var pattern = "---------- RECOMMENDATION 1 OF 3 IN GROUP 1 \(USD 168.90\)----------";
var result = Regex.Replace(sreader,pattern," ");
}