Function to remove HTML Tags from a string

 

 

The function below returns a string without HTML tags. This is the code:

 

Function strRemoveHTMLTag(strHTMLString)


        Dim rexExpression, strOutput

     

        'cretion of Regular Expression object

        Set rexExpression = New Regexp

 

        rexExpression.IgnoreCase = True
        rexExpression.Global = True

        rexExpression.Pattern = "<(.)+?>"

 

        'string manipulation
        strOutput = rexExpression.Replace(strHTMLString, "")

        strOutput = Replace(strOutput, "<", "")
        strOutput = Replace(strOutput, ">", "")
        strOutput = Replace(strOutput, "&quot;", """")

      

        'returns of the result to the function 

        strRemoveHTMLTag = "'" & strOutput

       

        'destruction of RegExp object

        Set rexExpression = Nothing

 

End Function

 

________________________________________________________________________

 

Pag: <<    <    >   >>