title: How to get value inside <a tag using preg match all?
body: <p>i got html content that need to extract values inside hyperlink tag using  preg match all. I tried the following but i don't get any data. I included a sample input data. Could you guys help me fix this code and print all values in front of play.asp?ID=(example: i want to get this value <strong>12345</strong> from play.asp?ID=<strong>12345</strong>) ?</p>
  
  <p>sample input html data:</p>
  
  <pre><code>&lt;A HREF="http://www.somesite.com/play.asp?ID=12345&amp;Selected_ID=&amp;PhaseID=123" class="space"&gt;&lt;span id="Img_1"&gt;&lt;/span&gt;&lt;/A&gt;&lt;/TD&gt;
  </code></pre>
  
  <p>and the code</p>
  
  <pre><code>$regexp = "&lt;A\s[^&gt;]*HREF=\"play.asp(\"??)([^\" &gt;]*?)\\1[^&gt;]*&gt;(.*)&lt;\/A&gt;";
  
  if(preg_match_all("/$regexp/siU", $input, $matches)) 
  { 
  
  
  $url=str_replace('?ID=', '', $matches[2]); 
  
  $url2=str_replace('&amp;Selected_ID=&amp;PhaseID=123', '', $url);
  
  print_r($url2);
  }
  </code></pre>