I'm currently working on a PHP project with a search engine which requires me to break down a search query to an array of substrings.
I want to support "doublequoting" so that the user is able to search for exact results e.g. "super secret stuff" only gets result with that exact string in their name while the same string without quotes returns results for "super" or "secret" or "stuff".
These quotes are supposed to be escapable.
Let me give you an example:
keyword Monday "Larrys \"House\"" epic
Should return an array of
[keyword, Monday, Larrys "House", epic]
I would like to support escaping of the backslashes too if this isn't too difficult to implement e.g. \\"
still counts as a quote, while \\\"
doesn't and so on.
Any help is appreciated!