RE: [PHP] Parse from a Text file
| From: | Rick Emery | Date: | Thu, 21 Mar 2002 15:25:01 +0000 |
| Subject: | RE: [PHP] Parse from a Text file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89513@lists.php.net to get a copy of this message | ||
You're welcome. we aims to please...
-----Original Message-----
From: Gerard [mailto:gmuste@tinet.org]
Sent: Thursday, March 21, 2002 9:22 AM
To: Rick Emery
Subject: Re: [PHP] Parse from a Text file
Many thanks Rick !
Much apreciated & very fast :-)
Gerard
----- Original Message -----
From: "Rick Emery" <remery@excel.com>
To: "'Gerard'" <gmuste@tinet.org>; <php-general@lists.php.net>
Sent: Thursday, March 21, 2002 4:18 PM
Subject: RE: [PHP] Parse from a Text file
As you read each line into a variable, $chrText, apply this test:
ereg("Visibility: ([0-9]*.*)", $chrText,$regs);
EXAMPLE:
<?php
$chrText = "Visibility: 30 mile(s):0";
ereg("Visibility: ([0-9]*.*)", $chrText,$regs);
print "#".$regs[0]."#".$regs[1]."#\n";
$regs= NULL;
$chrText = "Wind: from the NE (050 degrees) at 9 MPH (8 KT):0";
ereg("Visibility: ([0-9]*.*)", $chrText,$regs);
print "#".$regs[0]."#".$regs[1]."#\n";
?>
You will find what you need in $regs[1]
-----Original Message-----
From: Gerard [mailto:gmuste@tinet.org]
Sent: Thursday, March 21, 2002 8:44 AM
To: php-general@lists.php.net
Subject: [PHP] Parse from a Text file
Hi all,
I'm newbiee into php and I need some help.
I would like to parse some data from a Text file after some character.
For example I have this text file:
1st line Broomfield / Jeffco, CO, United States (KBJC) 39-55N 105-07W
2nd line Jun 04, 2000 - 02:45 PM EST / 2002.03.04 1945 UTC
3rd line Wind: from the NE (050 degrees) at 9 MPH (8 KT):0
4th line Visibility: 30 mile(s):0
And I would like to take only some data from the 4th line "30mile(s):0" and
nothing else...
Can somebody explain me who to do it ?¿
Many thanks
Gerard
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php