[rules-users] using matches in a collection

Edson Tirelli tirelli at post.com
Fri May 1 00:45:19 EDT 2009


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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090501/eed7319b/attachment.html 


More information about the rules-users mailing list