title: Combine regular expressions to extract data in C#
body: <p>I have a string that contains HTML that is hard coded to be in the following format:</p>
  
  <pre><code>&lt;span class="Marker" id="a"&gt;Some text 1&lt;/span&gt;&lt;br&gt;
  &lt;span class="Marker" id="b"&gt;Some text 2&lt;/span&gt;&lt;br&gt;
  &lt;span class="Marker" id="c"&gt;Some text 2&lt;/span&gt;&lt;br&gt;
  &lt;p class="inactive"&gt;Some text 4&lt;/p&gt;
  &lt;p class="inactive"&gt;Some text 5&lt;/p&gt;
  </code></pre>
  
  <p>My goal is to iterate over each line and:</p>
  
  <ol>
  <li>Extract the text.</li>
  <li>Check if the string contains <strong>class="Marker"</strong></li>
  </ol>
  
  <p>Store this information in a list.</p>
  
  <p>I want to first extract only the text from the HTML and save them to a list so I have the following:</p>
  
  <pre><code>//(?&lt;=&gt;)  -&gt; Lookbehind
  //(?=&lt;)   -&gt; Lookahead
  var matches = Regex.Matches(htmlString, "(?&lt;=&gt;)([^&lt;]+)(?=&lt;)");
  List&lt;string&gt; list = new List&lt;string&gt;();
  
  foreach (Match match in matches)
  {
     list.Add(match.Value);
  }
  </code></pre>
  
  <p>This works as expected.  Now I want to detect if each string contains the string class="Marker" so I have the following:</p>
  
  <pre><code>var classes = Regex.Matches(html, "(?&lt;=&lt;span class=\")([A-Za-z]+)(?=\")");
  List&lt;bool&gt; isPresentList = new List&lt;bool&gt;();
  foreach (Match cl in classes)
  {
      bool isPresent = cl.ToString().Equals("Marker", StringComparison.Ordinal);
      isPresentList.Add(isPresent);
  }
  </code></pre>
  
  <p>This also works as expected but I want to be able to do this in all one step if possible.</p>
  
  <p>Is there a way to combine the Regex filters together so I am returned the text and if the Marker is there or not (In a tuple for example)?</p>