开发者

remove <font> tag using hpricot

the html like this:

"[font color="#FF0000"]test [font color="#FF0000"]Hello world[/font][/font]"

I want to replace the font tag the result like this:

test Hello worl开发者_如何转开发d

thanks you


Just do doc.inner_text with hpricot

Sure it will remove all tags. Not only <font>.


doc.search("font").remove?


If you want to remove html and only want text USE

string = "<font color='#FF0000'>test <font color='#FF0000'>Hello world</font></font>"
strip_tags(string)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜