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(a)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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com