[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] need help with boolean parsing



Hi, Im writing a script that scans newsgroups and mails postings that
match a keyword to the email supplied by a cgi form.  I have it working
fine with one word searches.  But I want to go ahead and allow for 
searches to be made using boolean operators. e.g. (AND MAC MEMORY (NOT
PRICES))
Is there a module that will translate the line above into a pattern
matching variable? That is, is there a subroutine &translate that could
do the following:

$boolean_expression = '(AND MAC MEMORY (NOT PRICES))';
$translated_expression = &translate($boolean_expression);
if ($newsgroup_article =~ /$translated_expression/i){
      then keep the article
}

The point of this translation is to allow me to give &translate any 
expression that is constructed with AND, OR, NOT, ().
Or, is there an easier way to do this?
many thanks in advance -alan

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch