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


2008/6/25 ygaurav <ygaurav@yahoo.com>

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

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

}

@drools
rule "check something"
when
    $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
it

Thanks


--
View this message in context: http://www.nabble.com/using-matches-in-a-collection-tp18115893p18115893.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com