【发布时间】:2013-05-24 09:09:04
【问题描述】:
我想知道我们如何在c#中使用$no = ereg_replace(" .*", "", $command[$i]);等价物,我是模式匹配的新手,谁能告诉我c#中模式匹配的例子吗?
【问题讨论】:
标签: c# pattern-matching ereg-replace
我想知道我们如何在c#中使用$no = ereg_replace(" .*", "", $command[$i]);等价物,我是模式匹配的新手,谁能告诉我c#中模式匹配的例子吗?
【问题讨论】:
标签: c# pattern-matching ereg-replace
也许你可以使用正则表达式。
在本例中,我们要删除字符串中的所有 HTML 标签。
string newDescription = Regex.Replace("hello how are <b>you</b>", "<[^>]*>", string.Empty);
newDescription 现在有“你好,你好吗”
【讨论】:
String.Replace 应该更容易做到这一点。