Ok, shame on me it was too easy than I didn't see it.
My fault was a bad regular expression, this syntax is working fine.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Romain Van der Keilen
Sent: mardi 25 août 2009 11:14
To: [email protected]
Subject: [rules-users] DROOLS 4.0.7 Regular expression

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



_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to