Re: preg_grep Help (Regular expresion)
| From: | Jason Morehouse | Date: | Sun, 12 May 2002 11:31:46 +0000 |
| Subject: | Re: preg_grep Help (Regular expresion) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97217@lists.php.net to get a copy of this message | ||
$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 (jm@netconcepts.com)
Netconcepts LTD, Auckland, New Zealand
- Linux: because rebooting is for adding hardware.