2010-12-21 73 views
0

喜 首先对不起我的英语RegularExpressions删除特定HTML标记

我需要删除一个特定的HTML标签不是所有标签

这个我想在标签去除

xxx 

<object data="/dictionary/flash/SpeakerApp16.swf" type="application/x-shockwave-flash" width=" 16" height="16" id="pronunciation"> <param name="movie" value="/dictionary/flash/SpeakerApp16.swf"><param name="flashvars" value="sound_name=http%3A%2F%2Fwww.gstatic.com%2Fdictionary%2Fstatic%2Fsounds%2Fde%2F0%2Fman.mp3"><param name="wmode" value="transparent"><a href="http://www.gstatic.com/dictionary/static/sounds/de/0/man.mp3"><img border="0" width="16" height="16" src="/dictionary/flash/SpeakerOffA16.png" alt="listen"></a> </object> 

yyy 

我想要结果xxx yyy

+0

http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags – 2010-12-21 20:26:37

回答

0

如果你确切知道标签是什么,非正则表达式的搜索和替换将会更快,更高效。你对标签的形式了解多少?

此外,正则表达式& HTML是一件坏事。

+0

一个标签通常有属性,所以只是一个字符串替换可能是不够的。 – 2010-12-21 20:28:15