<a> contents <strong>strong content</strong> </a>
I want a only the "contents" i.e present between <a>
and <strong>
<a> contents <strong>strong content</strong> </a>
I want a only the "contents" i.e present between <a>
and <strong>
You will have to remove the string within <strong>
from string within <a>
-
var testString = "<a> contents <strong>strong content</strong> </a>";
var doc = new HtmlDocument();
doc.LoadHtml(testString);
var strWithinAnchor = doc.DocumentNode.SelectSingleNode("/a").InnerText;
var strWithinStrong = doc.DocumentNode.SelectSingleNode("/a/strong").InnerText;
var resultString = strWithinAnchor.Replace(strWithinStrong, string.Empty);