DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Remove HTML Tags From A String

  • submit to reddit
        // removes html tags from a string

function strip_html(str_html)
	dim objRegExp, str_output
	set objRegExp = new Regexp

	if not isNull(str_html) then
	objRegExp.IgnoreCase = True
	objRegExp.Global = True
	objRegExp.Pattern = "<(.|\n)+?>"

	str_output = objRegExp.Replace(str_html,"")
	str_output = Replace(str_output,"<","<")
	str_output = Replace(str_output,">",">")
	str_output = Replace(str_output,"""","'")
	strip_html = str_output
	end if
	set objRegExp = Nothing
end function