using System.Text.RegularExpressions;
public static void Main() {
var html = "<html><head></head><body><p>Hi try this link: <a href='https://example.com/Test'>Test</a><p></body></html>";
var plainText = HtmlToPlainText(html);
Console.WriteLine(plainText);
private static string HtmlToPlainText(string html) {
@"<(br|BR|/div)\s{0,1}\/{0,1}>";
var lineBreakRegex = new Regex(lineBreak, RegexOptions.Multiline);
var stripFormattingRegex = new Regex(stripFormatting, RegexOptions.Multiline);
var tagWhiteSpaceRegex = new Regex(tagWhiteSpace, RegexOptions.Multiline);
var headStartIndex = html.IndexOf("<head>");
var headEndIndex = html.IndexOf("</head>") + 7;
var text = string.Concat(html.Substring(0, headStartIndex), html.Substring(headEndIndex));
text = System.Net.WebUtility.HtmlDecode(text);
text = tagWhiteSpaceRegex.Replace(text, "><");
text = stripFormattingRegex.Replace(text, string.Empty);
text.Split(new[] { '\r', '\n', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)