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<file://(/?\\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