I need to get href for a link with specific anchor text, within an html page.
  </tr>
       <tr>
      <td><a href="/thisisafile.pdf" target="_blank" class="body1">
        This is some anchor text </a></td>
    </tr>
      <tr>
I need to pull out /thisisafile.pdf, I have tried the following code:
preg_match('~<a.*href="(.*?)".?>.?This is some anchor text.?</a>~sm',$temp,$matches,0);
$temp contains the code above.
I have tried the regex in an online preg_match tester, and it matches. I have tried the regex in a regex tester without delimiter, and it works. But when I try it on my server (linux), I get 0 matches (not false).
 
     
     
    