I need to pull all XML tags out of a string I have. Anyone have any clue what regex I could use??
Thanks,
Aaron
So far I have:
Function stripXML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "s/<[^<>""]*(""[^""]*""*[^<>""]*)*>//"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, ""
'Replace all < and > with &lt; and &gt;
'strOutput = Replace(strOutput, "<", "&lt;"
'strOutput = Replace(strOutput, ">", "&gt;"
stripXML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function
Thanks,
Aaron
So far I have:
Function stripXML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "s/<[^<>""]*(""[^""]*""*[^<>""]*)*>//"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, ""
'Replace all < and > with &lt; and &gt;
'strOutput = Replace(strOutput, "<", "&lt;"
'strOutput = Replace(strOutput, ">", "&gt;"
stripXML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function