preg_match help
Posted: Tue Jul 05, 2011 1:49 pm
Hi,
Basically I am trying to use the code below:
To find this code:
In a script that contains similar <td>'s, also the 0.69070 is subject to change. The preg_match that I am using isnt working and I cant work out why. I imagine it is something to do with the regex. The code that it is searching for is located in dump.text and this is all working fine, it just seems to be the preg_match.
Any help would be appreciated,
Thanks
Rhys
Basically I am trying to use the code below:
Code: Select all
<?php
$eurovalue = file_get_contents("dump.txt");
$eurovalue = htmlspecialchars($eurovalue);
$pattern = '/<td><a.*>USD\/EUR<\/a><\/td>.*<td\s*\w*>\s*<img\s*[\w\d]*\s*\/>(\d+)<\/td>/si';
preg_match($pattern,$eurovalue,$euroarray);
$euroresult = $euroarray[0];
echo $euroresult;
?>Code: Select all
<td><a href="/business/currencies/quote?srcAmt=1&srcCurr=USD&destAmt=&destCurr=EUR">USD/EUR</a></td>
<td class="data changeUp">
<img width="9" height="10" src="/resources_v2/images/changeUp.gif" />0.69070</td>Any help would be appreciated,
Thanks
Rhys