title: phone number Extracting from HTML Using regex
body: <p>I want to extract a phone number from HTML using regex.
  I am using this regex</p>
  
  <pre><code>\d{4}\s\d{3}\s\d{3}
  </code></pre>
  
  <p>for phone number <code>1234 546 567</code>. This regex successfully extracts the given phone number from HTML.</p>
  
  <p>But a problem occurs when there is another number (which I <em>don't</em> want to extract) like this: <code>1234 567 89023</code>. Now from this number it is also extracting <code>1234 567 890</code> but I don't want it to extract anything from that number.</p>
  
  <p>Then I changed the regex to</p>
  
  <pre><code>^\d{4}\s\d{3}\s\d{3}$
  </code></pre>
  
  <p>but now it is not even extracting any valid numbers.</p>
  
  <p>What should I do?
  Edited:</p>
  
  <pre><code>string MatchAusPhoneNumber = @"\D(\d{4}\s\d{3}\s\d{3})\D";
  MatchCollection mathph2 = Regex.Matches(chk, MatchAusPhoneNumber);
  
  foreach (Match matchio in mathph2)
  {
      foreach (Capture capture in matchio.Captures)
      {
          if (my.ContainsKey(capture.Value) == false)
          {
              my.Add(capture.Value, capture.Value);
              mylist.Add(capture.Value);
          }
      }
  }
  </code></pre>