title: Image tag scraper regular expression
body: <p>I'm really REALLY bad at regular expressions. It just hasn't clicked yet. I'm trying to make small application that extracts all image tags of their src, width, and height attributes. This is what I have so far:</p>
  
  <pre><code>&lt;?php
  
  function print_links ($url) 
  {
      $fp = fopen($url, "r") or die("Could not contact $url");
      $page_contents = "";
      while ($new_text = fread($fp, 100)) {
          $page_contents .= $new_text;
      }
  
  
      $match_result = 
      preg_match_all( '/&lt;img.*src=[\"\'](.*)[\"\'].*width=(\d+).*height=(\d+).*/&gt;/i',
                  $page_contents,
                  $match_array, 
                  PREG_SET_ORDER);
  
    echo "number matched is: $match_result&lt;br&gt;&lt;br&gt; ";
  
    print_r($match_array);
  
    foreach ($match_array as $entry) {
     $tag = $entry[0];
     $src = $entry[1];
     $width = $entry[2];
     $height = $entry[3];
     print  (" &lt;b&gt;src&lt;/b&gt;: $src; 
          &lt;b&gt;width&lt;/b&gt;:  $width&lt;br /&gt;
          &lt;b&gt;height&lt;/b&gt;:  $height&lt;br /&gt;
          &lt;b&gt;tag&lt;/b&gt;:  $tag&lt;br /&gt;"
          );
      }
  
  }
  
  print_links ("http://www.drudgereport.com/");
  
  ?&gt;
  </code></pre>
  
  <p>but I get this little error:</p>
  
  <p>Warning: preg_match_all(): Unknown modifier '>' in     C:\Apache2.2\htdocs\it302\regex\regex.php on line 17 number matched is: </p>
  
  <p>I'm not sure where I went wrong in my regexp. I've tried multiple things but have ended up just as confused.</p>
  
  <p>Any suggestions?</p>