Remove HTML Tags from String Variable in C#

Include System.Text.RegularExpressions


public string Strip(string text)
{
return Regex.Replace(text, @”<(.|\n)*?>”, string.Empty);
}

String myArticle=Strip("<a href="#"><b>Article</b></a>");

This code will help us to remove the HTML tags contained in a string variable using Regular Expression.
Tags: ,
Hot on Web:


About author