Jess doesn't have a regular expression matcher, although this is
something I've contemplated putting in.
You can do what you want by calling out to Java explicitly; for
instance, you could use String.indexOf():
(defrule list
(row (name ?s&:(neq -1 (call ?s indexOf "new"))) (value ?b))
=>
(printout t "List:" ?b crlf ))
I.e., we're testing the Java expression s.indexOf("new") != -1 .
I think Skokan, Ladislav wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hello All
>
> I am new in Jess/Lisp and I am faced to solve such problem:
> This is simplified example:
>
> >>>>>>>>>>> code
> (deftemplate row (slot name) (slot value))
>
> (assert (row (name new) (value 1)) )
> (assert (row (name news) (value 1)) )
>
> (defrule list (row (name new) (value ?b)) => (printout t "List:" ?b crlf ))
> (run)
> >>>>>>>>>>>>>> code
>
> I now need to list each row , where name STARTS with or CONTAINS the word
> "new".
> This example lists only words exactly maching name "new".
>
> Does anybody have any idea how to do it ?
>
> Thanx,
> Laco Skokan.
>
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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]
---------------------------------------------------------------------