using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
string material_string = @"<TABLE height=100%>\r\n<TBODY>\r\n<TR>\r\n<TD>\r\n<DIV id=lmid>Лист 29НК-10 ГОСТ 14082-78</DIV></TD>\r\n<TD style=BORDER-BOTTOM-WIDTH: 1px>\r\n<DIV id=righted style=DISPLAY: none>\r\n<TABLE>\r\n<TBODY>\r\n<TR>\r\n<TD style=BORDER-BOTTOM: #000 1px solid>\r\n<DIV id=rtop></DIV></TD></TR>\r\n<TR>\r\n<TD>\r\n<DIV id=rdown></DIV></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE><!--CADЛист 29НК-10 ГОСТ 14082-78-->";
string pattern = @"<DIV id=lmid>(|.+?)</DIV>";
string pattern2 = @"<DIV id=rdown>(|.+?)<\/DIV>";
r = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);
m = r.Match(material_string);
res = m.Groups[1].ToString();
res = res.Replace(" ", " ").Trim();
Console.WriteLine(m.Groups[0].ToString() + "___" + m.Groups.Count.ToString() + " " + res);
r = new Regex(pattern2, RegexOptions.IgnoreCase | RegexOptions.Singleline);
m = r.Match(material_string);
res = m.Groups[1].ToString();
res = res.Replace(" ", " ").Trim();
Console.WriteLine(m.Groups[0].ToString() + "___" +m.Groups.Count.ToString() + " " + res);