[rules-users] Contains substring in the LHS with regular expression capturing groups?

Edson Tirelli tirelli at post.com
Fri Dec 14 06:42:59 EST 2007


   Yes, you may use matches. The other alternative is using an eval and a
regular indexOf() call to check for the existance of the substring. Drools
up to versions 4.0.x is JSE 1.4 compliant, so you can't use contains()
method.  In trunk, you may also develop your own operator and plug it into
the engine... although, it is not documented yet, but if you want to try, I
can guide you through. And if you want to contribute docs after that, even
better. :)

   It is not possible to capture groups and reuse in the RHS. I'm thinking
about a way to bind variables to arbitrary values in the LHS. If we
implement that, than it would be possible for you to do that, but not
possible at this moment.

   Edson

2007/12/14, Waruzjan Shahbazian <wshahbazian at xiam.nl>:
>
> Hi,
>
> I need to check in the LHS of my rule if  a given String contains an
> given substring. What is the best way to do that? I can use regular
> expression with matches, but is that the best (fastest) solution?
> (STRING matches "(?i).*SUBSTRING.*"). And can I use regulare expressions
> capturing groups and than use the results of the groups in the RHS? If
> not, what is the best methode to do that?
>
> Thanks,
>
> Waruzjan
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071214/e5bc7c40/attachment.html 


More information about the rules-users mailing list