I have read a html file as string builder.Now I want to put anchor tag between h1,h2,and h3 and to give different id and href link. So how can I achive this.I want following thing to do.
I have tried Sb.Replace("<h1>", "<h1> <a id=1>"); but I can not give uniqe Id to anchor tag.So how can I read all h1,h2 and h3 and put anchor tag and give unique id to anchor tag.
I have read a html file as string builder.Now I want to put anchor
Share
You can call
Regex.Replacein theSystem.Text.RegularExpressionsnamespace and define a customMatchEvaluatorcallback where you assign the new ids.Something like the following:
And define the EvaluateHeaders callback something like this:
EDIT
In light of your latest comment, I’ve changed the code to the following: