Searching for text in text file

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
ylkien
New php-forum User
New php-forum User
Posts: 28
Joined: Sat Dec 14, 2002 9:43 am

Sat Sep 06, 2003 8:30 am

Hi,

i looked through the functions list, but i could find any function that could search something (like a phrase) in a text file. The closes i could get is fseek(), which isn't what i want. Could there be a function like "fsearch"?


thanks.

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sat Sep 06, 2003 9:13 am

there are no such function....

try to use regular expresions for searching string in text file...

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Sat Sep 06, 2003 10:44 am

you would need to read the file into php and use preg_match.

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Sat Sep 06, 2003 11:30 pm

Redcircle wrote:you would need to read the file into php and use preg_match.


Or just strpos() for simple matching.
Image

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1279
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Sun Sep 07, 2003 9:50 pm

use the file function get the text in the array and then use array functions to search the text :idea:

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests