Deleting a range of characters in a string

I’m trying to get rid of all the html tags in my string. Is there a way to do this?

For example
set msg to "something something
"

I want to delete only the html tags(basically anything between “<” and “>”), so that I can just get “something something”

Thanks!

Here’s one way to do it:

set msg to "<b>something</b> <i>something</i> <br>"

repeat while msg contains "<"
	set tagStart to offset of "<" in msg
	set tagEnd to offset of ">" in msg after tagStart
	if tagEnd is zero then exit repeat -- found "<" without a following ">", so stop looking
	delete chars tagStart to tagEnd of msg
end repeat
put "["& msg & "]"