title: Scrape a price off a website
body: <p>I'm trying to scrape a price from a web page using PHP and Regexes. The price will be in the format £123.12 or $123.12 (i.e., pounds or dollars).</p>
  
  <p>I'm loading up the contents using libcurl. The output of which is then going into <code>preg_match_all</code>. So it looks a bit like this:</p>
  
  <pre><code>$contents = curl_exec($curl);
  
  preg_match_all('/(?:\$|£)[0-9]+(?:\.[0-9]{2})?/', $contents, $matches);
  </code></pre>
  
  <p>So far so simple. The problem is, PHP isn't matching anything at all - even when there are prices on the page. I've narrowed it down to there being a problem with the '£' character - PHP doesn't seem to like it.</p>
  
  <p>I think this might be a charset issue. But whatever I do, I can't seem to get PHP to match it! Anyone have any ideas?</p>
  
  <p>(Edit: I should note if I try using the <a href="http://www.spaweditor.com/scripts/regex/index.php" rel="nofollow noreferrer">Regex Test Tool</a> using the same regex and page content, it works fine)</p>