RE: [PHP] splitting text solved

From: Date: Wed, 04 Jun 2003 11:48:34 +0000
Subject: RE: [PHP] splitting text solved
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-150133@lists.php.net to get a copy of this message
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: daniel@electroteque.org [mailto:daniel@electroteque.org] Sent: Wednesday, June 04, 2003 3:41 PM To: php-general@lists.php.net 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

« previous php.general (#150133) next »