How to strip this text
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<test@test.com>
</body>
</html>
to look like
My First Heading
My first paragraph.
<test@test.com>
Using the function
public static string StripHTML(this string htmlText)
{
var reg = new Regex("<(.|\n)*?>", RegexOptions.IgnoreCase);
return reg.Replace(htmlText, "");
}
I get
My First Heading
My first paragraph.
1 Answer