[rules-users] DROOLS 4.0.7 Regular expression
Romain Van der Keilen
Romain.VanderKeilen at uniway.be
Tue Aug 25 05:14:03 EDT 2009
Hi there,
I'm looking how to use regular expression with Drools 4.
I've already found some things but they don't work.
Here is an example I want to do, considering all getters and setters are properly written:
Class House
+ private Window myWindow
+ private Phone myPhone
Class Door
+ private String name
Class Phone
+ private String phoneNumber
Let's say in my country phone numbers are the following type: xx/xxx.xx.xx
If I give my house to the session, how can I check if the phone is correct? I've tryied this but that's not working:
rule "Check phone"
when
h : House ( phone: phone );
eval ( phone != null );
Phone ( phoneNumber matches "^ -regex- $");
then
System.out.println("my phone is correct");
End
Thanks for help,
Romain Van der Keilen
More information about the rules-users
mailing list