title: Regex Readline to Count Tags
body: <p>I have a problem reading every line to count the regex of <code>&lt;a href=</code>
  when the regex been match it will skip the line and not finish till the end.  For example, here I have two <code>&lt;a href</code> tags, but after reading the first one it will jump to the next line:</p>
  
  <p><code>"&lt;p class="txt"&gt;Everyone seemed cool with that, including Coach A, so we went to work putting it all together. The end result had us starting off standing in a &lt;strong&gt;V formation&lt;/strong&gt;&lt;a href="../Text/chap5.html#b1" id="f1"&gt;*&lt;/a&gt;, and then the girls in back would tumble forward so that we were all in a straight line for the cheer. It was a really cool idea! To finish things off, we’d transition into two stunt groups that would do side-by-side &lt;strong&gt;elevators&lt;/strong&gt;&lt;a href="../Text/chap5.html#b2" id="f2"&gt;&lt;/a&gt;.&lt;/p&gt;"</code></p>
  
  <p>Here is my code:</p>
  
  <pre><code>        Dim count1 As Integer = 0
          For p As Integer = 0 To lvw.Items.Count - 1
          Dim r As StreamReader = New StreamReader(New FileStream(Path.Combine(lvw.Items(p).Tag, lvw.Items(p).Text), FileMode.Open, FileAccess.Read, FileShare.Read))
  
          Do While Not r.EndOfStream
              Dim strr1 As String = r.ReadLine.Trim
              Try
                  Dim regex As Regex = New Regex("&lt;a\s+[^&gt;]*(href\s*=\s*(['""]).*?\2)")
                  Dim m As Match = regex.Match(strr1)
  
                  If m.Success Then
                      count1 += 1
  
                  End If
                  Label2.Text = (count1.ToString)
              Catch ex As Exception
              End Try
          Loop
  
      Next
  </code></pre>