src code

instance method String#stripTags

String#stripTags() → String

Strips a string of any HTML tags.

Note that stripTags will only strip HTML 4.01 tags — like div, span, and abbr. It will not strip namespace-prefixed tags such as h:table or xsl:template.

Caveat User

Note that the processing stripTags does is good enough for most purposes, but you cannot rely on it for security purposes. If you're processing end-user-supplied content, stripTags is probably not sufficiently robust to ensure that the content is completely devoid of HTML tags in the case of a user intentionally trying to circumvent tag restrictions. But then, you'll be running them through String#escapeHTML anyway, won't you?