[PHP] Re: preg_grep Help (Regular expresion)

2002-05-12 Thread Jason Morehouse

$file needs to be an array:

$file = file(myfile.txt);

On Sun, 12 May 2002 12:56:08 +1200, Brian C. Doyle wrote:

 Hello all,
 
 I have a file that has ip address in it.. I need to pull those ip
 addresses out.
 Currently I am trying:
 
 $ips=preg_grep(/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/,$file);
 print_r(array_values ($ips));
 
 And well i am getting nothing!
 
 Anyone?
 

-- 
 Jason Morehouse ([EMAIL PROTECTED])  
 Netconcepts LTD, Auckland, New Zealand
 - Linux: because rebooting is for adding hardware.

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




Re: [PHP] Re: preg_grep Help (Regular expresion)

2002-05-12 Thread Brian C. Doyle

Hello all,

I did foget to mention that I had $file as
$file=file(Status.htm);
and it reads the file as 1 line it seams.


At 11:31 PM 5/12/02 +1200, Jason Morehouse wrote:
$file needs to be an array:

 $file = file(myfile.txt);

On Sun, 12 May 2002 12:56:08 +1200, Brian C. Doyle wrote:

  Hello all,
 
  I have a file that has ip address in it.. I need to pull those ip
  addresses out.
  Currently I am trying:
 
  $ips=preg_grep(/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/,$file);
  print_r(array_values ($ips));
 
  And well i am getting nothing!
 
  Anyone?


--
  Jason Morehouse ([EMAIL PROTECTED])
  Netconcepts LTD, Auckland, New Zealand
  - Linux: because rebooting is for adding hardware.

--
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