i found a snippet somewhere which helped me out and i modified it

<?
$input    = "and a phrase \"escaping text\" \"howard sux\"";


if (preg_match_all('/(?:"((?:\\\.|[^\\\])*?)"|\b([\S]+)\b)/', $input,
$match)) {
        foreach ($match[0] as $key=>$value) {
                $keyword .= " +".$value;
        }
}
echo $keyword;
?>

so basically u can have a heap of keywords with some in exact phrases within
quotes and it adds the + for you to make it an AND boolean search string for
mysql full text :D


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 3:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] splitting text


hi there , i am building a fulltext search engine which will use the mysql
boolean search features , although it defaults to OR with words between
spaces you have to explictly put a + in front of words so say i typed

"some word" word2 ,to get both i have to do +"some word" +word2

how can i split this phrase "some word" word2 so that i can split "some
word" and word2 into two different words so i can format them , currently
split on a space will split "some word" into "some and word" any ideas ?



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


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

Reply via email to