From: Reini U. <ru...@us...> - 2004-11-30 09:49:32
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29247 Modified Files: TextSearchQuery.php Log Message: fix PCRE word boundaries Index: TextSearchQuery.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/TextSearchQuery.php,v retrieving revision 1.14 retrieving revision 1.15 diff -u -2 -b -p -d -r1.14 -r1.15 --- TextSearchQuery.php 29 Nov 2004 17:55:47 -0000 1.14 +++ TextSearchQuery.php 30 Nov 2004 09:49:23 -0000 1.15 @@ -324,5 +324,5 @@ class TextSearchQuery_node_starts_with extends TextSearchQuery_node_word { var $op = "STARTS_WITH"; - function regexp() { return '(?=' . preg_quote($this->word, '/') . ')'; } + function regexp() { return '(?=\b' . preg_quote($this->word, '/') . ')'; } function sql() { return $this->_sql_quote($this->word).'%'; } } @@ -331,5 +331,5 @@ class TextSearchQuery_node_ends_with extends TextSearchQuery_node_word { var $op = "ENDS_WITH"; - function regexp() { return '(?=' . preg_quote($this->word, '/') . '.*)'; } + function regexp() { return '(?=' . preg_quote($this->word, '/') . '\b)'; } function sql() { return '%'.$this->_sql_quote($this->word); } } @@ -338,5 +338,5 @@ class TextSearchQuery_node_exact extends TextSearchQuery_node_word { var $op = "EXACT"; - function regexp() { return '(?=\B' . preg_quote($this->word, '/') . '\b)'; } + function regexp() { return '(?=\b' . preg_quote($this->word, '/') . '\b)'; } function sql() { return $this->_sql_squote($this->word); } } @@ -345,5 +345,5 @@ class TextSearchQuery_node_regex // posi extends TextSearchQuery_node_word { var $op = "REGEX"; // using REGEXP or ~ extension - function regexp() { return '(?=\B' . $this->word . '\b)'; } + function regexp() { return '(?=\b' . $this->word . '\b)'; } function sql() { return $this->_sql_quote($this->word); } } @@ -352,5 +352,5 @@ class TextSearchQuery_node_regex_glob extends TextSearchQuery_node_regex { var $op = "REGEX_GLOB"; - function regexp() { return '(?=\B' . glob_to_pcre($this->word) . '\b)'; } + function regexp() { return '(?=\b' . glob_to_pcre($this->word) . '\b)'; } } |