[rules-users] The use of 'matches' in Guvnor (and binded variables)

Wolfgang Laun wolfgang.laun at gmail.com
Fri Aug 31 10:09:19 EDT 2012


In DRL you would have to write

   x  matches (".*_" + $itemID)

Note that you can also write

   x str[endsWith] $itemID

This has the subtle difference that all "magic" that can be brought
about by characters in $itemID being used as a pattern is avoided. If,
for instance, an $itemID contains "some.id", the '.' accepts any
character.

(Obviously I'm assuming that $itemID is not meant to contain a
"regular expression".)

-W


On 31/08/2012, TonyN <tony.n.nguyen at boeing.com> wrote:
> I am not sure if it is my syntax issue or DROOLS (failed to expand binded
> variable), but I cannot get the 'match' to work using either (BRL or DRL)
> rules.
>
> basically, I want to do this:
>
> x matches '.*_$itemID'
>
> where $itemID is a binded variable (define in a clause above)....
>
> I am using Guvnor 5.2.0 Final (Does 'match' accept binded variable on this
> version?)
>
> thx,
> Tony
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/The-use-of-matches-in-Guvnor-and-binded-variables-tp4019417p4019480.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list