Re: ereg + Fed Ex Rate URL Question
| From: | php3 at developersdesk dot com | Date: | Tue, 15 Aug 2000 01:56:45 +0000 |
| Subject: | Re: ereg + Fed Ex Rate URL Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11712@lists.php.net to get a copy of this message | ||
Addressed to: callen <callen@driver8.org>
PHP General List <php-general@lists.php.net>
** Reply to note from callen <callen@driver8.org> Mon, 14 Aug 2000 16:34:06 +0000
>
> I ma sending a query to
> "http://grd.fedex.com/cgi-bin/..." and I am
> receiving back a html file that contains the line
> <!TotalCharges>4.71<!/TotalCharges>
>
> I can't seem to land this right in my reg-exp: .... if ( ereg (
> "^(<!TotalCharges>)([0-9]{1,4})(\.)([0-9]{1,2})(<!/TotalCharges>)$",
> $buffer, $arr)) { ....
>
> Can anyone straighten out this expression so that it matches that
> line?
How about:
<?
$Text = '<!TotalCharges>4.71<!/TotalCharges>';
if( ereg( 'Charges>([0-9]*\.[0-9]*)<!', $Text, $R )) {
echo "Hit: $R[1]<BR>\n";
}
?>
Returns:
Hit: 4.71
Rick Widmer
Internet Marketing Specialists
www.developersdesk.com