rule "at least one element from the array starts with abc"
    ABC( $array : array )
    exists( String( this matches "abc.*" ) from $array )
    // do something

2008/6/25 ygaurav <>

Hi All

i am new to drools and I am hoping that some body can help me out here.

I data in string array and I would like to check if one of the entry starts
with the string I have. How can check it  ?

Code is shown below

class ABC {
String[] array = new String[]{"abcdef","ghijkl","mnopqrst"}


rule "check something"
    $abc : ( ABC.array contains a single entry which start with "abc" )

Is there a way I can do it ? If it is not possible what is way I can achive


View this message in context:
Sent from the drools - user mailing list archive at

rules-users mailing list

 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @