Strip HTML in any string in Ruby


A little code snippet to let you remove HTML from any string in Ruby:
class String

# remove all HTML tags from the source string
def strip_html
self.gsub(/]*>/, "")

Then to run the code just do this:
blurb_html = "

Thanks for visiting our site.

blurb_text = blurb_html.strip_html

How to reply

Care to add your own 2 cents? Let me know via Twitter or my contact page.