[rules-users] Re: escaping backslash in matches clauses (documentation bug?)

Godmar Back godmar at gmail.com
Tue Sep 25 22:34:37 EDT 2007


PS. I was a bit too quick with my email; that is not to say that I
don't suspect there to be a problem.
It appears to depend on whether the left-hand side of the matches
clause is a field or a Java expression.

For instance:

      f : Fact( w matches "\." )

does not require escaping in accordance with the documentation, but if
I match on a different expression:

     f : Fact(w.somebeanproperty matches "\\.")

escaping the "\" becomes required.

 - Godmar

On 9/25/07, Godmar Back <godmar at gmail.com> wrote:
> The documentation states that '\' occurring in matches clauses do not
> need escaping. However, unescaped '\' cause this error message when
> compiling the .drl file:
>
> Exception in thread "main" org.drools.rule.InvalidRulePackage: Unable
> to determine the used declarations : [Rule name=Apply XML Descriptor,
> agendaGroup=MAIN, salience=0, no-loop=false]
>
>         at org.drools.rule.Package.checkValidity(Package.java:419)
>         at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:292)
>
> Escaping the '\' as is customary in Java makes the code work.
>
>  - Godmar
>



More information about the rules-users mailing list