· Aug 29, 2016

Regular Expression to Strip HTML Tags

I want to use the Regex Matcher to strip HTML tags, but I get a REGEX error. Can anyone explain what I'm doing wrong?

set htmlSnippet = "<h1>Hello</h1>"
set regex = ##class(%Regex.Matcher).%New()
set regex.Text = htmlSnippet
set regex.Pattern = "<[^>]*>"
set plainText = regex.ReplaceAll(" ")
write !,plainText

Discussion (1)0
Log in or sign up to continue