Page 1 of 1

Faster word search?

Posted: Tue Jan 20, 2004 9:52 am
by elmonty
I'm doing a word search of a very large text file. Currently, I am using the following code to do the searching:

Code: Select all

$pattern = '/\b' . $term . '\b/i';
$found   = preg_match($pattern, $msg);
Is there a faster way to search for a word other than using a regexp? I only want to find whole words.