The following codes does not work, I am trying to retrive TR strings from a HTML table. Is there any issue with this code or any other solution available?
public static List<string> GetTR(string Tr)
{
List<string> trContents = new List<string>();
string regexTR = @"<(tr|TR)[^<]+>((\s*?.*?)*?)<\/(tr|TR)>";
MatchCollection tr_Matches = Regex.Matches(Tr, regexTR, RegexOptions.Singleline);
foreach (Match match in tr_Matches)
{
trContents.Add(match.Value);
}
return trContents;
}
Sample input string is given below:
"<TR><TD noWrap align=left>abcd</TD><TD noWrap align=left>SPORT</TD><TD align=left>5AT</TD></TR>"