【发布时间】:2012-04-18 06:22:14
【问题描述】:
我有一个 Html 代码,我想将它转换为纯文本,但只保留彩色文本标签。 例如: 当我有以下 Html:
<body>
This is a <b>sample</b> html text.
<p align="center" style="color:#ff9999">this is only a sample<p>
....
and some other tags...
</body>
</html>
我想要输出:
this is a sample html text.
<#ff9999>this is only a sample<>
....
and some other tags...
【问题讨论】:
-
你写的代码是什么
-
thanx,未指定代码。带有颜色名称标签的纯文本。
-
但是你需要写一些代码来解析代码,对吧?
-
@Ali.M - Satya 的意思是你用什么来尝试实现这一目标? jQuery? php?正则表达式?
-
另外,您想将
<p>替换为<>,但<b>什么都不替换?
标签: c# html html-parsing