I'm having trouble getting my head set straight on this one..

I'd like to be able to have a rule fire if two or more facts are NOT true 
using regular expressions, but can't seem to figure out the right rule 
def.

Given the following setup:

(assert (value "aa"))
(assert (value "Bb"))
(assert (value "cc"))
(assert (value "Dd"))
(assert (value "ee"))

(defrule only-when-starts-with-B-and-D-present
        (value /B.*/)
        (value /D.*/)
        =>
        (printout t "B* and D* present" crlf)
)

yields

B* and D* present


but I can't seem to figure out how to get this one to work such that the 
RHS is fired only when no fact starts with either /B.*/ or /D.*/ regular 
expressions...

(assert (value "aa"))
;;(assert (value "Bb"))
(assert (value "cc"))
;;(assert (value "Dd"))
(assert (value "ee"))

(defrule only-when-starts-with-B-and-D-NOT-present
 
        (value /(?!B).*/)
        (value /(?!D).*/)
        =>
        (printout t "B* and D* NOT present" crlf)
)

fires whether or not B and D are present or not.

I've tried various incarnations of the tests, using a Jess "not" 
condition, various flavors of regex expressions, all to no avail.  Can 
anyone tell me what I'm doing wrong?? Is it a misuse of facts/rules, or a 
misunderstanding of just what the LHS can do?

Thanks.


-- Mike
____________________

Michael Stopper
Systems Development Scientist
SPS Enterprise Architect
CACI Transformation Solutions Group

Tel 703.460.1845
Mobile 703.407.7058
[EMAIL PROTECTED]  | www.caci.com

Reply via email to