I am using following code, it replaces entities in whole html file.
But I want to replace only in between specified tags(i.e <div>......</div>)
please help me
{
FileInfo n = new FileInfo(inputpath);
string initContent = File.ReadAllText(file);
int contentLength = initContent.Length;
Matches m;
while ((m = Regex.Matches(initContent, "[^a-zA-Z0-9<>=./\\s(&#\\d+;)-]")).Value != String.Empty)
initContent = initContent.Remove(m.Index, 1).Insert(m.Index, string.Format("&#{0};", (int)m.Value[0]));
File.WriteAllText(outpath, initContent);
}