X-Git-Url: http://git.sourceforge.jp/view?p=nucleus-jp%2Fnucleus-jp-ancient.git;a=blobdiff_plain;f=utf8%2Fnucleus%2Flibs%2FSEARCH.php;h=fea865a3afccd346ed7a9a43b48856db3bcfd77c;hp=baad7a280ef8ec1936c2e955b731f72ecec67cde;hb=cad22282df851433a5d18146e83149987a4bddb5;hpb=573b43d7c3e3f8d700c969b8935bc18021be0506 diff --git a/utf8/nucleus/libs/SEARCH.php b/utf8/nucleus/libs/SEARCH.php index baad7a2..fea865a 100755 --- a/utf8/nucleus/libs/SEARCH.php +++ b/utf8/nucleus/libs/SEARCH.php @@ -94,7 +94,7 @@ class SEARCH { function boolean_inclusive_atoms($string) { $result = trim($string); - $result = preg_replace("/([[:space:]]{2,})/", ' ', $result); + $result = preg_replace("#([[:space:]]{2,})#", ' ', $result); # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0 # just added delimiters to regex and the 'i' for case-insensitive matching @@ -112,7 +112,7 @@ class SEARCH { /* strip exlusive atoms */ $result = preg_replace( - "(\-\(([A-Za-z0-9]|$this->two|$this->three){1,}([A-Za-z0-9\-\.\_\,]|$this->two|$this->three){0,}\))", + "#\-\(([A-Za-z0-9]|$this->two|$this->three){1,}([A-Za-z0-9\-\.\_\,]|$this->two|$this->three){0,}\)#", '', $result); @@ -155,10 +155,12 @@ class SEARCH { $result=trim($string); $result=preg_replace("/([[:space:]]{2,})/",' ',$result); - // convert normal boolean operators to shortened syntax - $result=eregi_replace(' not ',' -',$result); - $result=eregi_replace(' and ',' ',$result); - $result=eregi_replace(' or ',',',$result); + # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0 + # just added delimiters to regex and the 'i' for case-insensitive matching + + $result = preg_replace('# not #i', ' -', $result); + $result = preg_replace('# and #i', ' ', $result); + $result = preg_replace('# or #i', ',', $result); // strip excessive whitespace $result=str_replace('( ','(',$result); @@ -170,12 +172,13 @@ class SEARCH { // remove double spaces (we might have introduced some new ones above) $result=trim($result); - $result=preg_replace("/([[:space:]]{2,})/",' ',$result); + $result=preg_replace("#([[:space:]]{2,})#",' ',$result); // apply arbitrary function to all 'word' atoms - $result_a = explode(" ",$result); - for($word=0;$word