Start by replacing the double escape by a simple escape... after that, drools simply makes a call to String.matches() method... so, if you make it work in java, it will work in drools...
   E.g.:

"^(([\+]?\d{1,3}(-|......"

   []s
   Edson

2008/6/2 Nagaraju runkana <runkana.nagaraju@gmail.com>:
 Hi ,
i am trying validate complex expression for phone numberl?
 
rule "test2"
 when
  $m : Message(email:email,phone:phone)
 Message(phone matches "^(([\\+]?\\d{1,3}(-|\\.)?\\(?\\w\\)?(-|\\.)?\\d{1,3})|(\\(?\\d{2,3}\\)?))(-|\\.)?(\\d{3,4})(-|\\.)?(\\d{4})(( x| ext)\\d{1,5}){0,1}$"
then
   System.out.println("Invalid phone number: " + phone );
end "
 
 
in this case  some error should be comming.pls find out whethere the expression is correct or not.
 
java.util.regex.PatternSyntaxException: Unknown inline modifier near index 21
^(([+]?d{1,3}(-|.)?(?w)?(-|.)?d{1,3})|((?d{2,3})?))(-|.)?(d{3,4})(-|.)?(d{4})(( x| ext)d{1,5}){0,1}$
                     ^
 at java.util.regex.Pattern.error(Pattern.java:1713)
 at java.util.regex.Pattern.group0(Pattern.java:2519)
 at java.util.regex.Pattern.sequence(Pattern.java:1806)
 at java.util.regex.Pattern.expr(Pattern.java:1752)
 at java.util.regex.Pattern.group0(Pattern.java:2530)
 at java.util.regex.Pattern.sequence(Pattern.java:1806)
 at java.util.regex.Pattern.expr(Pattern.java:1752)
 at java.util.regex.Pattern.group0(Pattern.java:2530)
 at java.util.regex.Pattern.sequence(Pattern.java:1806)
 at java.util.regex.Pattern.expr(Pattern.java:1752)
 at java.util.regex.Pattern.compile(Pattern.java:1460)
 at java.util.regex.Pattern.<init>(Pattern.java:1133)
 at java.util.regex.Pattern.compile(Pattern.java:823)
 at java.util.regex.Pattern.matches(Pattern.java:928)
 at java.lang.String.matches(String.java:2091)
 at org.drools.base.evaluators.StringFactory$StringMatchesEvaluator.evaluate(StringFactory.java:211)
 at org.drools.rule.LiteralRestriction.isAllowed(LiteralRestriction.java:61)
 at org.drools.rule.LiteralConstraint.isAllowed(LiteralConstraint.java:82)
 at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:132)
 at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
 at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
 at org.drools.reteoo.Rete.assertObject(Rete.java:175)
 at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
 at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
 at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
 at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
 at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
 at com.sample.DroolsTest.main(DroolsTest.java:40)
 
 
regards,
Chanti

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com