Fjern bestemte tags fra HTML-streng
Hej alleJeg har nogle script, som fjerner nogle bestemte html-tags, dog virker funktioner, som skulle fjerne form-tagget samt script-tagget ikke.
Kan du hjælpe?
Function StripDiv (ByRef asHTML)
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "(<div[^<]+<\/div>)"
StripDiv = regEx.Replace(asHTML, "")
Set regEx = Nothing
End Function
Function StripForm (ByRef asHTML)
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "(<form[^<]+<\/form>)"
'regEx.Pattern = "(<form.*?</form>)"
StripForm = regEx.Replace(asHTML, "")
Set regEx = Nothing
End Function
Function StripHeadings (ByRef asHTML)
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "(<h[1-7].*?</h[1-7]>)"
StripHeadings = regEx.Replace(asHTML, "")
Set regEx = Nothing
End Function
Function StripStyle(ByRef asHTML)
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "(<style[^<]+<\/style>)"
StripStyle = regEx.Replace(asHTML, "")
Set regEx = Nothing
End Function
Function StripScript(ByRef asHTML)
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "(<script[^\¨]*\<\/script>)"
StripScript = regEx.Replace(asHTML, "")
Set regEx = Nothing
End Function
