RE: [PHP] Parse from a Text file

2002-03-21 Thread Rick Emery

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:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 8:44 AM
To: [EMAIL PROTECTED]
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




RE: [PHP] Parse from a Text file

2002-03-21 Thread Rick Emery

You're welcome.  we aims to please...

-Original Message-
From: Gerard [mailto:[EMAIL PROTECTED]]
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 [EMAIL PROTECTED]
To: 'Gerard' [EMAIL PROTECTED]; [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
Sent: Thursday, March 21, 2002 8:44 AM
To: [EMAIL PROTECTED]
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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php