I have recieved help over las couple of days with some regex coding. As I'm sure you're aware, with every breakthrough comes another question and I'm stuck on the following

$url = 'http://www.islandcosmetics.com/p/Vera-Wang-for-Men-Eau-De-Toilette-Spray-50ml.html';
$html = file_get_contents($url);

preg_match('/<div class=\"padding9px\"><p?>(.+?)(\d+\.\d+)?<br \/><strong><span class=\"orange\">(.*)<\/span><\/strong><\/p><\/div>/', $html, $match);
$out = $match[2];

This first one is in relation to trying to grab the "38.00" and no more for the RRP of a product. Where am I going wrong?

The second relates to this query... for the data within the brackets:

<td class="rrp"><strong>RRP</strong>

								&pound;27.00 | <strong>SAVE</strong>
								&pound;5.50</td>

For this web address, 'http://www.directcosmetics.com/detail.cfm?code=15362' how would I even begin to construct a regex to grab the "27.00" RRP and nothing more?

Regex scrambles my brain. Any help or ideas are greatly appreciated, honestly!

Cheers! :)

Dude, I didn't understand your first part. But here's the answer for your second part.

<?php
$url = 'http://www.directcosmetics.com/detail.cfm?code=15362';
$html = file_get_contents($url);
$reg = '/<td class=\"rrp\"><strong>RRP<\/strong>(.*)<strong>SAVE<\/strong>/s';
preg_match($reg,$html,$matches);
$rep_array=array("&pound;","|");
print str_replace($rep_array,"",$matches[1]);
?>

Cheers,
Naveen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.