[rules-users] Simple rule worked in 4.0.7 and failed in 5.0.1
Corneil du Plessis
corneil at tsctech.com
Thu Jun 25 09:39:31 EDT 2009
Txank you
On Thu, 2009-06-25 at 08:19 -0400, Edson Tirelli wrote:
>
> I added a comment to the JIRA, but replicate it here for
> completeness:
>
> =====
> Due to some limitations on the way that Drools 4 handles regexps, we
> had to change the default escaping syntax for regexps, from single
> escape to double escape. In Drools 5, regexps work exactly like in
> Java. So, instead of doing:
>
> ".*\s(ADDR)\s.*|(ADDR)\s.*|.*\s(ADDR)"
>
> You need to write:
>
> ".*\\s(ADDR)\\s.*|(ADDR)\\s.*|.*\\s(ADDR)"
>
> If you would like to continue using regexps in the same way you did
> for Drools 4, i.e., with single escape (not recommended), there is a
> configuration that makes Drools 5 parse regexps as it did in Drools 4.
> Using the type safe API, you can do:
>
> KnowledgeBuilderConfiguration config =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
> config.setOption( ProcessStringEscapesOption.NO);
> KnowledgeBuider kbuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder( conf );
>
> If you prefer to use the property or configuration file, then it is:
>
> drools.parser.processStringEscapes = false
> =======
>
> []s
> Edson
>
>
> 2009/6/25 Corneil du Plessis <corneil at tsctech.com>
>
> I ran into some problems where a fairly simple rule fails in
> 5.0.1 and worked in 4.0.7.
>
> I have created an issue on JIRA
> https://jira.jboss.org/jira/browse/JBRULES-2136 and was
> wondering if someone else has come across that same type of
> problem.
>
> The rule is:
>
>
> package org.drools.rules.test
> import org.drools.rules.test.SimpleStringType
> rule "SimpleKeywordTest"
> dialect "java"
> when
> $_theFact : SimpleStringType( stringValue matches ".*\s(ADDR)\s.*|(ADDR)\s.*|.*\s(ADDR)" )
> then
> $_theFact.setValid(false);
> end
>
>
> Whenever the stringValue contains something like 'MY ADDR' the
> rule should fire but it doesn't in 5.0.1
>
> Corneil
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
> --
> Edson Tirelli
> JBoss Drools Core Development
> JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090625/d003990a/attachment.html
More information about the rules-users
mailing list