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>"
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.
精彩评论