title: Regular expression to match meta tags
body: <p>Hi I want to extract the og:image content from a page source. How can I extract og:image meta tag content from source?</p>
  
  <p>This is meta tag:</p>
  
  <pre><code>&lt;meta property="og:image" content="http://www.moneycontrol.com/news_image_files/2013/s/Syrian_diesel_trucks_190.jpg" /&gt;
  </code></pre>
  
  <p>How can I identify the meta tag using regular expression?</p>
  
  <p>This is my current function grab image url from img tags. What modification it needed to work with og:image meta tags?</p>
  
  <pre><code>function feeds_imagegrabber_scrape_images($content, $base_url, array $options = array(), &amp;$error_log = array()) {
  
  // Merge the default options.
  $options += array(
    'expression' =&gt; '//img',
    'getsize' =&gt; TRUE,
    'max_imagesize' =&gt; 512000,
    'timeout' =&gt; 10,
    'max_redirects' =&gt; 3,
    'feeling_lucky' =&gt; 0,
  );
  
  $doc = new DOMDocument();
  if (@$doc-&gt;loadXML($content) === FALSE &amp;&amp; @$doc-&gt;loadHTML($content) === FALSE) {
    $error_log['code'] = -5;
    $error_log['error'] = "unable to parse the xml//html content";
    return FALSE;
  }
  
  $xpath = new DOMXPath($doc);
  $hrefs = @$xpath-&gt;evaluate($options['expression']);//echo '&lt;pre&gt; HREFS : ';print_r($hrefs-&gt;length);exit;
  
  if ($options['getsize']) {
    timer_start(__FUNCTION__);
  }
  
  $images = array();
  $imagesize = 0;
  for ($i = 0; $i &lt; $hrefs-&gt;length; $i++) {
    $url = $hrefs-&gt;item($i)-&gt;getAttribute('src');
    if (!isset($url) || empty($url) || $url == '') {
      continue;
    }
    if(function_exists('encode_url')) {
      $url = encode_url($url);
    }
    $url = url_to_absolute($base_url, $url);
  
    if ($url == FALSE) {
      continue;
    }
  
    if ($options['getsize']) {
      if (($imagesize = feeds_imagegrabber_validate_download_size($url, $options['max_imagesize'], ($options['timeout'] - timer_read(__FUNCTION__) / 1000))) != -1)   {
        $images[$url] = $imagesize;
        if ($settings['feeling_lucky']) {
          break;
        }
      }
      if (($options['timeout'] - timer_read(__FUNCTION__) / 1000) &lt;= 0) {
        $error_log['code'] = FIG_HTTP_REQUEST_TIMEOUT;
        $error_log['error'] = "timeout occured while scraping the content";
        break;
      }
    }
    else {
      $images[$url] = $imagesize;
      if ($settings['feeling_lucky']) {
        break;
      }
    }
  }
  echo '&lt;pre&gt;';print_r($images);exit;
  return $images;
  }
  </code></pre>