I have some text and at different positions of this text I have some HTML links such as <a href="link">text</a>
.
I would like to convert it into [url=link]text[/url]
.
I know how to read the href, and the text alone, for instance:
var link = doc.SelectNodes("//a");
string link = link.Attributes["href"].value;
string text = link.InnerText;
but would could I replace it back into the text at the same place without hurting the text, missing the position, etc ?
Example:
The brown fox <a href="link">jumped over</a> the table while the rabbit <a href="link">scaped from it</a>.
Would become:
The brown fox [url=link]jumped over[/url] the table while the rabbit [url=link]scaped from it[/url].