开发者

Regular expression to strip all HTML tags except sub & sup tags

I need to strip all html tags from a string except <sub></sub> & <sup></sup> tags.

Suppose if a string is "<p>Hello world&开发者_Python百科lt;/p> <span class="required">H<sub>2</sub>O</span>"

Output should be Hello world H<sub>2</sub>O


Rather than using regular expressions, you may find it easier to use something like Html Agility Pack which gives you a read/write DOM to play with.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜