glwtta has asked for the wisdom of the Perl Monks concerning the following question:
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: converting a boolean syntax
by BrowserUk (Patriarch) on Jun 23, 2003 at 22:29 UTC | |
|
Re: converting a boolean syntax
by Abigail-II (Bishop) on Jun 23, 2003 at 22:32 UTC | |
|
Re: converting a boolean syntax
by Tomte (Priest) on Jun 23, 2003 at 22:34 UTC | |
|
Re: converting a boolean syntax
by diotalevi (Canon) on Jun 23, 2003 at 22:35 UTC | |
|
Re: converting a boolean syntax
by parv (Parson) on Jun 23, 2003 at 22:49 UTC | |
|
Re: converting a boolean syntax
by artist (Parson) on Jun 23, 2003 at 22:22 UTC | |
|
Re: converting a boolean syntax
by kutsu (Priest) on Jun 23, 2003 at 21:32 UTC |