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

2007-12-14 Thread Edson Tirelli
The difference is not in sharing the nodes, but in indexing... although, today, only "==" constraints are indexed. So, "matches" operator is really just syntax sugar on String.matches() method call. In other words, if you have 2 rules with identical eval() calls, they may be shared, the sa

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

2007-12-14 Thread Edson Tirelli
Oh, and I missed another important difference: eval() always generates code in java dialect, while operators are resolved directly, without the need to generate code... so besides syntax sugar, there is a small gain in compilation time performance. []s Edson 2007/12/14, Edson Tirelli <

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

2007-12-14 Thread Waruzjan Shahbazian
The pluggable operators example looks very cool :-) , I just have one more question about the performance. I suppose that if I use eval() with indexOf(), there would be no caching? Isn't that one of the benefits of using the "drools" operators, since ( if they work on the same way as in the ex

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

2007-12-14 Thread Edson Tirelli
I really don't know about perf differences in this case. I guess best thing would be for you do give a try (and let us know please). :) It probably will depend on the java implementation of the matches() against indexOf() method. I guess indexOf is faster, but don't know if it is significant dif

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

2007-12-14 Thread Waruzjan Shahbazian
Hi, Thanks for the reply. I wanted to be sure that there wasn't any more efficient way to check a substring in a string, or do you think that eval() with a indexOf() call would be more efficient than matches() with regular expression?. Since I can't group the results, the speed is the only is

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

2007-12-14 Thread Edson Tirelli
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

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

2007-12-14 Thread Waruzjan Shahbazian
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 gro