Good Regex for general text search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm writing a few very simple search scripts.

One searches in a few columns of a CSV file, while another just searches through a collection of file names.

Currently, I just have it stripping illegal characters from the "needle" and "haystack" then doing a substring search

if (substr_count(...)>0) {
   return formatted results....
}

What I'm looking to do is enhance my searches with preg_match. What I want to do is take my needle and haystack with the illegal strings stripped out, split it down to words, and search for the string, no matter what is between the words.

ex: "the cat and the dog"

would also return

"the cat ran from the bull and dog"

I might learn Regular Expressions at some point in the future, but I just haven't had time to yet... so what I need is just what I would use to build my string pattern for preg_match... I'll figure out the rest and change my scripts appropriately.

Thanks in Advance!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux