Remove HTML tags from string

It’s so easy to remove HTML tags from your text or code instead of using the lengthy codes or functions, just use these regular expression in your coding,



Regular Expression: "<[^>]*>"


Eg Code: Vb.net


Public Function RemoveHTMLTab(ByVal pHTMLString As String) As String

     Return System.Text.RegularExpressions.Regex.Replace(pHTMLString, "<[^>]*>", String.Empty)

End Function


Eg Code : C#.net

public string RemoveHTMLTab(string pHTML) as string

{
    return System.Text.RegularExpressions.Regex.Replace(pHTMLString, "<[^>]*>", string.Empty);
}

No comments: