Need help with regular expression
Posted: Wed Nov 08, 2006 8:14 am
I am currently using on my php/Mysql db. The only problem is the expression is taking way to long to do the search of the db, even though the db is properly indexed. The expression finds an exact match in the Topic field which is what I wanted. However, the speed of search problem and the server load is a bigger problem. Here is the query with the regular expression.
Is there a way to change the regular expression above to find a white space before the variable if the variable is within a sentence or find the variable if the variable is the first word in the sentence. For example, if the user wants to find the word "fear" without the quotes, the regular expression would find...
fear
fearless
fearlessly
fearful
fearsome
...if these words appear at the beginning of a sentence or within a sentence.
Thank you in advance for any replies.
Code: Select all
$query = "SELECT * FROM `View6` WHERE `Topic` REGEXP '[[:<:]]" .
mysql_real_escape_string($SeeAlso) .
"[[:>:]]' AND `Source` = $NNN OR (`Source` = $TTT) ORDER BY `Lnum` ASC";Code: Select all
$SeeAlsoCode: Select all
$SeeAlsoCode: Select all
$SeeAlsoCode: Select all
$SeeAlsofear
fearless
fearlessly
fearful
fearsome
...if these words appear at the beginning of a sentence or within a sentence.
Thank you in advance for any replies.