Hi,
I have an email validation regex where the mvel matches doesn't seem to work. I have created 2 rules where test1 uses the Java String matches and test2 uses the mvel matches. Test1 works but test2 doesn't. I am using Drools 4.0.3 and JDK 1.6.0_02. rule "Test1" when // This works email : String() eval( !email.matches( "^[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+( \\.[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+ )[EMAIL PROTECTED]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9 -]{0,61}[a-zA-Z0-9])?)*\\.[a-zA-Z]{2,6}$" ) ) then System.out.println( "1-Invalid Email Address: " + email ); end rule "Test2" when // This doesn't work email : String( toString not matches "^[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+( \\.[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]+ )[EMAIL PROTECTED]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9 -]{0,61}[a-zA-Z0-9])?)*\\.[a-zA-Z]{2,6}$" ) then System.out.println( "2-Invalid Email Address: " + email ); end Here's the output using email addresses [EMAIL PROTECTED] (valid) and x.xx.com (invalid): test1-Invalid Email Address: x.xx.com test2-Invalid Email Address: [EMAIL PROTECTED] test2-Invalid Email Address: x.xx.com The regex expressions are exactly the same. Am I doing something wrong here? Thanks, Len
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users