Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Parsing text files

General discussions related to php

Moderators: macek, egami, gesf

Parsing text files

Postby glow » Mon Dec 16, 2002 3:51 am

Hi all i've a generall question about parsing text files.

What's the simplest way for searching, for example e-mail adresses, in a text file? is there already a php function for something like this available? (excuses my bad English)

THX ahead for your answers :wink:
glow
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Nov 26, 2002 11:00 am

Postby Oleg Butuzov » Mon Dec 16, 2002 4:36 am

simple serch code


Code: Select all
$file=file("file.txt");

$num=count($file);
for ($i=0; $i < $num; $i++)
{
    if (eregi("[a-z]+@[a-z]+\.[a-z]{2,3}", $file))
    {
    echo  " $file[$i]\n<br>";
    }
}
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

THX

Postby glow » Mon Dec 16, 2002 4:58 am

great! Thanks a lot! :-)
glow
New php-forum User
New php-forum User
 
Posts: 10
Joined: Tue Nov 26, 2002 11:00 am

Postby Oleg Butuzov » Mon Dec 16, 2002 5:02 am

you wellcome! =)
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron