<%
'-----------------------------------------------------
'Nome: RemoveHTMLTags(ByVal strHTML)
'Tipo: Funcao
'Sinopse: Remove todas as tags HTML de uma string
'Parametros:
' strHTML: String com as tags HTML a serem retiradas
'Retorno: String
'Autor: Gabriel Fróes - www.codigofonte.com.br
'-----------------------------------------------------
Function RemoveHTMLTags(ByVal strHTML)
Dim objER
Dim strTexto
'Configurando o objeto de Expressão Regular
Set objER = New RegExp
objER.IgnoreCase = True
objER.Global = True
objER.Pattern = "<[^>]*>"
'Substituindo as tags encontradas pela expressão
strTexto = strHTML
strTexto = objER.Replace(strTexto, "")
Set objER = Nothing
'Retornando a função
RemoveHTMLTags = strTexto
End Function
'-----------------------------------------------------
'Exemplo de chamada da função
'-----------------------------------------------------
Dim HTML
HTML = "<font face='verdana' size='2'>teste</font> da função de retira as <b>TAGS</b> <font color='red'>HTML</font><br>"
'Texto com TAG
Response.Write HTML
'Texto sem TAG
Response.Write RemoveHTMLTags(HTML)
%>