How do I use C# regular expression to replace/remove all HTML tags, including the angle brackets? Can someone please help me with the code?
try regular expression method at this URL: http://www.dotnetperls.com/remove-html-tags
///
/// Remove HTML from string with Regex.
///
public static string StripTagsRegex(string source)
{
return Regex.Replace(source, "<.*?>", string.Empty);
}
///
/// Compiled regular expression for performance.
///
static Regex _htmlRegex = new Regex("<.*?>", RegexOptions.Compiled);
///
/// Remove HTML from string with compiled Regex.
///
public static string StripTagsRegexCompiled(string source)
{
return _htmlRegex.Replace(source, string.Empty);
}