C#中的ereg_replace等价物

时间:2013-05-29 07:49:46

标签: c# pattern-matching ereg-replace

我需要知道如何在c#中使用$ no = ereg_replace(" .*", "", $command[$i]);等价物,我是模式匹配的新手,有谁能告诉我c#中模式匹配的例子?

1 个答案:

答案 0 :(得分:1)

也许你可以使用正则表达式。

在此示例中,我们要删除字符串中包含的所有HTML标记。

string newDescription = Regex.Replace("hello how are <b>you</b>", "<[^>]*>", string.Empty);

newDescription现在有“你好,你好吗”

相关问题