I'm trying to code a search-string parser that can take a string like '"staffordshire terrier" breeding info' from a user-input search box and turn it into an SQL query for the terms 'staffordshire terrier', 'breeding' and 'info'.
I have no problems cleaning up the string and boiling it down to 'LIKE %staffordshire% AND LIKE %terrier% AND LIKE %breeding% AND...'. The main problem I'm having is getting the parser to treat quoted strings ("staffordshire terrier") as a single unit when splitting the string into component terms, so I can have 'LIKE %staffordshire terrier% AND LIKE %breeding% AND...'. Is there any elegant solution?