title: Best way to filter HTML-file for certain Words
body: <p>I want to read and filter a HTML-file. My plan is to read the file line by line and only save lines that are "encapsulated" by the td tags (I cant copy them here because they wont show up for some reason).
  For example:</p>
  
  <pre class="lang-html prettyprint-override"><code>
      &lt;html&gt;
        &lt;head&gt;
          &lt;META http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
          &lt;title&gt;
                Tabelle Artikel&lt;/title&gt;
        &lt;/head&gt;
        &lt;body&gt;
          &lt;table width="900" cellspacing="0" cellpadding="0"&gt;
            &lt;tr&gt;
              &lt;td style="vertical-align:top;font-family:Arial;font-size:14pt;"&gt;
                    Tabelle &lt;strong&gt;Artikel&lt;/strong&gt;&lt;span style="font-size:10pt;padding-left:10"&gt;&lt;a href="_Index.html"&gt;Tabellen-Übersicht&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td style="vertical-align:top;font-family:Arial;font-size:.8em;padding-bottom:5;padding-left:30;"&gt;&amp;nbsp;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
              &lt;td&gt;
                &lt;table border="0" cellpadding="1" cellspacing="0" style="border:1px solid darkgray;width:100%"&gt;
                  &lt;thead&gt;
                    &lt;tr&gt;
                      &lt;td style="font-family:Arial; font-size:.9em;font-weight:bold;"&gt;Name&lt;/td&gt;
                      &lt;td style="font-family:Arial; font-size:.9em;font-weight:bold;"&gt;Label&lt;/td&gt;
                      &lt;td style="font-family:Arial; font-size:.9em;font-weight:bold;"&gt;Typ&lt;/td&gt;
                      &lt;td style="font-family:Arial; font-size:.9em;font-weight:bold;"&gt;MDT&lt;/td&gt;
                      &lt;td style="font-family:Arial; font-size:.9em;font-weight:bold;"&gt;Format&lt;/td&gt;
                    &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                    &lt;tr style="background-color:black;color:white;"&gt;
  
  </code></pre>
  
  <p>In this example only these lines that were encapsulated by the TD tags would be saved to the string</p>
  
  <p>Its pretty straight forwards and easy if it werent for the fact that the encapsulated text might be large enough to be multiple lines long. This make it hard for me to filter it (Im a beginner). </p>
  
  <pre><code>        static void Main(string[] args)
      {
          string line = "";
          string FilteredHTML = "";
          bool SaveLine = false;
  
          using (StreamReader Reader = new StreamReader(@"FilePath"))
          {
              while ((line = Reader.ReadLine()) != null)
              {
                  if (line.Contains("&lt;td") || SaveLine == true)
                  {
                      {
                          FilteredHTML += line;
                          SaveLine = true;
                      }
  
                  }
                  if (line.Contains("&lt;/td&gt;") &amp;&amp; (!line.Contains("&lt;td")))
                  {
                      {
                          FilteredHTML += line;
                          SaveLine = false;
                      }              
                  }
              }
          }
          while (FilteredHTML.Contains("  ")) FilteredHTML = FilteredHTML.Replace("  ", " ");
          string Output = "";
          string Delimiter = "&lt;/td&gt;";
          var tokens = Regex.Split(FilteredHTML, Delimiter);
          foreach (var item in tokens)
          {
              Output = item;
              Output += Delimiter;
              Console.WriteLine(Output);
          }
          Console.ReadLine();
      }
  </code></pre>
  
  <p>This works to a certain extend but I still have Text before the  tags. And the fact that im Adding the Delimiter manually after using it also causes multiple  in a row to show up. </p>
  
  <p>As you can see this is a mess and I tried my best to make it work but I cant help but think that there has to be a easier way to Filter HTML file for certain lines. 
  I also tried to use the HTML-Agility pack but I didnt find anything that would help me with filtering out certain lines.</p>