Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Strip Html Tags

DZone's Guide to

Strip Html Tags

·
Free Resource
Originally from segabor@textsnippets
The regex below removes html tags from string (untested).


str = <
  


  
   

Application error

Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html

HTML_TEXT puts str.gsub(/<\/?[^>]*>/, "")
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}