Straightforward problem, I have a database that uses the following syntax for boolean searches: "word1 word2" will find either word 1 or 2, "+word1 +word2" will find both and "+word1 -word2" will find 1 and not 2; etc, simple enough... just try explaining that to anyone using it though.
So what I need to do is convert the more familiar "(word1 AND word2) OR word3" syntax to this one (btw, parenthesis work the same way in both).
From whatever knowledge of CS I have I understand that this is pretty much beyond what regular expressions can do, but it also seems like doing some sort of parse tree would be overkill (plus I don't really know how to go about it) - any suggestions for a pragmatic approach to this?
In reply to converting a boolean syntax by glwtta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |