Method to remove html escape characters from strings

Is there a convenient way of removing html escape characters from
Strings? I could do using reg exp as in:

=> “hello & goodbye”

“hello & goodbye”.gsub(/&/, “&”)
=> “hello & goodbye”

but I figured there might be a better way.

thx.

Is there a convenient way of removing html escape characters from
Strings? I could do using reg exp as in:

=> “hello & goodbye”

“hello & goodbye”.gsub(/&/, “&”)
=> “hello & goodbye”

but I figured there might be a better way.

require ‘CGI’>> require ‘CGI’
=> true

CGI::unescapeHTML(“hello & goodbye “bar” <baz>”)
=> "hello & goodbye “bar” "

That worked. Thanks!

If found this little snap that I got in my application_helper

def remove_html_tags(str)
str.gsub(/</?[^>]*>/, “”)
end