Search Engine Keywords Parser

Viewed 2655

Here is what I want to do:

I need to create a search engine parser that uses the following operators:

  • Apples AND Oranges (AND operator)
  • Apples OR Oranges (OR operator)
  • Apples AND NOT Oranges (AND NOT operator)
  • " Apples " (Quotes operator)
  • Apples AND ( Oranges OR Pears ) (Parentheses operator)
  • Appl* (Star operator)

With some preg_replace, I manage to convert the string into an array and then I parsed this array to get a MySQL query. But I don't like that way and it's very unstable!

I searched the web for some script that does that and I didn't have any luck!

Can someone please help me implement this??

Thanks

5 Answers
Related