title: Matching SRC attribute of IMG tag using preg_match
body: <p>I'm attempting to run preg_match to extract the SRC attribute from the first IMG tag in an article (in this case, stored in $row->introtext).</p>
  
  <pre><code>preg_match('/\&lt; *[img][^\&gt;]*[src] *= *[\"\']{0,1}([^\"\']*)/i', $row-&gt;introtext, $matches);
  </code></pre>
  
  <p>Instead of getting something like</p>
  
  <pre><code>images/stories/otakuzoku1.jpg
  </code></pre>
  
  <p>from</p>
  
  <pre><code>&lt;img src="images/stories/otakuzoku1.jpg" border="0" alt="Inside Otakuzoku's store" /&gt;
  </code></pre>
  
  <p>I get just</p>
  
  <pre><code>0
  </code></pre>
  
  <p>The regex should be right, but I can't tell why it appears to be matching the border attribute and not the src attribute.</p>
  
  <p>Alternatively, if you've had the patience to read this far without skipping straight to the reply field and typing 'use a HTML/XML parser', can a good tutorial for one be recommended as I'm having trouble finding one at all that's applicable to PHP 4.</p>
  
  <p>PHP 4.4.7</p>