Re: Search for words

From: Date: Tue, 19 Mar 2002 14:20:19 +0000
Subject: Re: Search for words
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89133@lists.php.net to get a copy of this message
if(stristr( $file_data, $word )) die( "word found" ); that will work for one word -- for many words -- I would use: if(preg_match("/word1|word2|word3/i", $file_data)) die( "one or more words found" ); However, that does use preg -- which is MUCH faster than EREG but neither is as fast as a straight out text search. if you go the preg route you need to make sure you form your expression correctly... but for words ... just | will do you fine. -Joe "Martin Kampherbeek" <m.kampherbeek@home.nl> wrote in message news:006701c1cecb$806e9be0$328078d9@groni1.gr.nl.home.com... Hi, Someone submits an URL to me. Now I want a script that checks for some words in the file right after submitting. When the word is in the file it must stop. For example the words: house and school.

« previous php.general (#89133) next »