Politics, Computers, Ruby on Rails, and Miscellaneous.
#!/usr/bin/ruby -nputs $_.gsub(/<\/?[^>]*>/, "")
Thanks! I'll be using this for stripping <font> tags for HTML highlighted source code in Vim. I can now select the HTML source, and then go, :!killhtmlto get rid of those tags and focus on the content UNDER the html code.
If you work in Ruby on Rails, you can use a text helper to accomplish this: http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M000633Note that this uses a tokenizer which may be more effective than your regex which has problems with things like:input type="text" value="a=>b"(leading/trailing "<" ">" marks removed to reduce tag stripping by blog comment engine)
Priceless - thanks!
Thanks! I'll be using this for stripping <font> tags for HTML highlighted source code in Vim. I can now select the HTML source, and then go, :!killhtml
ReplyDeleteto get rid of those tags and focus on the content UNDER the html code.
If you work in Ruby on Rails, you can use a text helper to accomplish this:
ReplyDeletehttp://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M000633
Note that this uses a tokenizer which may be more effective than your regex which has problems with things like:
input type="text" value="a=>b"
(leading/trailing "<" ">" marks removed to reduce tag stripping by blog comment engine)
Priceless - thanks!
ReplyDelete