Hello, PHP-type folks.

I'm attempting to parse up search parameters from a user-inputted form into
something I can build a query with.  For example, given the string
"\"grizzly bear\" or tiger and carnivorous mammal", I'd like to split it
into an array like this:

array[0] = array("'grizzly bear'", "badger")
array[1] = "mammal"
array[2] = "carnivorous"

so that ANDed values (explicitely with "and" keyword or implicitely with
whitespace) are separate entries in the main array, with ORed values
together in sub-arrays, preserving double-quoted phrases without ANDing them
and replacing the double-quotes with single quotes.

Quite a mess, I know, and I'm getting knowwhere with my limited regular
expression experience.  Splitting up AND and OR blocks is easy enough with
simple strings "owl and screech or pygmy" but this preservation of quoted
phrases is killing me.  Any help would be appreciated.

Thanks,


Justin Smith
New Mexico Natural Heritage Program
University of New Mexico
Department of Biology
167 Castetter Hall
Albuquerque, New Mexico 87131
505-277-3822 x226
505-277-3844 (fax)
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to