Hello!

You can write a Java extension and use (load-function)
to import a new command into Jess. The procedure is
described in detail with examples in manual section 5.

You will find a nice Java regular expression package
at http://jakarta.apache.org/oro/index.html.
It helps you to keep your Java code short and easy.

Regards,
Norman



-----Original Message-----
From: Peter Olsen [mailto:[EMAIL PROTECTED]]
Sent: Mittwoch, 7. Februar 2001 06:21
To: [EMAIL PROTECTED]
Subject: JESS: Regular Expressions in Jess?


I'm writing an application in which I want to base decisions partly on
whether or not attributes match regular expressions.  For example, I
might want to match regular expression "Pe*er" with the fact "(town
(name Peterboro))."

so that, if I executed something like the following statements

(deftemplate town (slot name)(slot state))
(assert (town (name Peterboro)(state NH)))
(assert (town (name Paulsboro)(state NJ)))

(defrule regexp-rule
   (town (name "Pe*er")(state ?st))
   =>
   (prinout t "The state I wanted was " ?st "." crlf))

(run)

I would get the output

"The state I wanted was NH."


I know that I can write code in Java or execute an external program
(e.g. egrep) to do this, but I would like to do it entirely within
Jess if I can.

I haven't found any clues either in the Jess Manual or in the CLIPS
books I've checked, but I may not yet know enough about CLIPS to be
looking for the right things.

Thanks!

Peter Olsen

-- 
Peter Olsen, PE                                      703-516-7304
Principal Member of Technical Staff              FAX 703-528-5918
The Charles Stark Draper Laboratory             SWBD 703-243-2600
1555 Wilson Boulevard, Suite 501               [EMAIL PROTECTED]
Arlington VA 22209

Scientists investigate that which already is; engineers create that which
has never been. --Albert Einstein

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify
[EMAIL PROTECTED]
---------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to