[rules-users] Test if String endsWith()

Omar Baqueiro baqueiro at ooyala.com
Mon Nov 12 17:44:45 EST 2012


Hello,

I am trying to evaluate certain data with Drools based on the end of a
string. So far, I have got the following mvel based DRL ( My Wrapper class
has the fields (with all their accessors) id, email and list):

---
rule "Check the items of the list and remove the ones that satisfy the
condition"
    lock-on-active
when
    $wrapper : Wrapper(
                id == "itemId",
                email.endsWith("@email.com") == true,
                $items : list)
    $item    : Map() from $items
then
    $items.remove($item)
end
----


However, when trying to apply this rule, I get the  error: no viable
alternative at input '"@gmail.com"' in rule ...".

What is the correct way to test whether a string ends with certain text
(i.e, using the String.endsWith function using MVEL)

Thanks for any help!


-- 
--
*Omar Baqueiro Espinosa*
Software Engineer |
baqueiro at ooyala.com | +52 (33) 3817-0861
www.ooyala.com | blog <http://www.ooyala.com/blog> |
@ooyala<http://www.twitter.com/ooyala>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121112/93adf3a5/attachment-0001.html 


More information about the rules-users mailing list