Why not yank the quoted terms out before using split?  Search for patterns
".*" and put them in a separate array.  Once those are gone, split the
remaining string.  You may want to remove duplicate spaces created by
removing the quoted terms.

"Kevin Won" <[EMAIL PROTECTED]> wrote in message
I'm having a bit of difficulty getting my REGEXP right for my search engine.
I'm hoping someone has done this already--it is actually a rather simple
problem but I suck at regexps . . .

problem:  need to concatinate a query string with like '%searchterm%' from a
list of words from a webform, but also need to identify "quoted terms" which
should not have wildcards infront/behind them.

so the result for a search query of

this is "my search" term set

should end up:

SELECT * FROM TABLE WHERE keywords LIKE '%this%'
OR keywords LIKE '%is%'
OR keywords LIKE 'my search'
OR keywords LIKE '%term%'
OR keywords LIKE '%set%'

so the quoted term doesn't have the wildcards in front/behind.

I'm using preg_split to cut the words using a \s space character
presently--I haven't yet implemented containing "quoted terms". I'm unsure
how to keep the "quoted terms" together yet split the other words apart.

I'm guessing someone has done this on the list. ..


Kevin Won
ITG Web Developer,
Systems Administrator
Oregon Health Sciences University
(503) 418-4282
cell: (503) 913-5367
page: x15897
fax: (503) 494-1888

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

Reply via email to