Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ruby strip HTML tags
# copied from (thanks!):
str = <<HTML_TEXT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<h1>Application error</h1>
<p>Change this error message for exceptions thrown outside of an action (like
in Dispatcher setups or broken Ruby code) in public/500.html</p>
puts str.gsub(/<\/?[^>]*>/, "")
Copy link

ArtBears commented Mar 31, 2016

This is great! Thanks for the gist =)

Copy link

matiasa18 commented Aug 25, 2016

Thank you! 👍

Copy link

parag90-zz commented Dec 1, 2016

Thank you, Very useful !!

Copy link

v4vasanth commented Feb 24, 2017

Not all heroes wear capes

Copy link

meowsus commented Oct 29, 2017

Copy link

juryghidinelli commented Apr 5, 2018

Thank you!

Copy link

illtellyoulater commented Jul 26, 2020


Copy link

Beyarz commented Nov 24, 2020

This did the job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment