C# C中的通配符替换正则表达式
我搜索了又搜索,看到了一些看起来像解决方案的代码,但它不起作用。我没有使用正则表达式的经验,我想看看我在这里做错了什么C# C中的通配符替换正则表达式,c#,regex,replace,C#,Regex,Replace,我搜索了又搜索,看到了一些看起来像解决方案的代码,但它不起作用。我没有使用正则表达式的经验,我想看看我在这里做错了什么 string line = input.Replace("<td>", ";"); string withoutTabs = Regex.Replace(line, "\t", ";"); string withoutTD = Regex.Replace(withoutTabs, ".*</td>", ";"); 上面的代码试图替换HTML表布局中的所
string line = input.Replace("<td>", ";");
string withoutTabs = Regex.Replace(line, "\t", ";");
string withoutTD = Regex.Replace(withoutTabs, ".*</td>", ";");
上面的代码试图替换HTML表布局中的所有和选项卡。但它不起作用,它不会移除标签,也不会替换标签。标签通常附加到一些文本上,如:text
我希望它看起来像这样:文本
有人能指出我的错误吗,或者我的正则表达式都错了,我需要用别的东西来代替它吗
我想用替换以及和选项卡
那不是:
string withoutEndTD = Regex.Replace(withoutTabs, "</td>", ";");
这实际上是相同的做法:
string withoutEndTD = withoutTabs.Replace("</td>", ";");
如果您想获取任何
string withoutEndTD = withoutTabs.Replace("</td>", ";");