Max Benjamin <moore.joseph / gmail.com> wrote:
> Is there an easy way to strip html tags from strings?

A regex isn't always the _best_ way to deal with markup
languages, but for an _easy_ way it's good enough.


$ irb
irb(main):001:0> a = '<strong>This is strong stuff!</strong><br><img src="foo.png" alt="Some foo">'
=> "<strong>This is strong stuff!</strong><br><img src=\"foo.png\" alt=\"Some foo\">"
irb(main):002:0> a.gsub(/<.*?>/, '')
=> "This is strong stuff!"