<br> At this time, there is no such feature. May I ask you please to open a JIRA feature request for it?<br> The way I see it, we would need to create a feature to allow binding of variables to arbitrary expressions in the LHS and allow this binds to be used in the RHS.
<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/9/22, Godmar Back <<a href="mailto:godmar@gmail.com">godmar@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 9/22/07, Edson Tirelli <<a href="mailto:tirelli@post.com">tirelli@post.com</a>> wrote:<br>><br>> Sorry, nope. Is there a use case for that?<br>><br><br>For instance, I'd like to write a rule where I need to be alerted of
<br>all facts where a specific field is of the form "(.*)Suffix". The<br>action I'm then taking requires the "(.*)" as a parameter.<br>The value of "Suffix" does not matter to the action and should be
<br>restricted to the .drl file (as it matters there only.)<br><br>If I cannot capture the match, I will have to pay both a cost in<br>runtime and in expressiveness. In runtime because the regular<br>expression match is repeated in the action.
<br>In expressiveness, because my code is now less localized since there<br>will be 2 places that deal with "Suffix". If I repeated "Suffix" in<br>the match and action as a string literal, changing it would require
<br>changing it in two places:<br><br>when n : Name (value matches "(.*)Suffix")<br>then TakeAction(n, "Suffix")<br><br>I do not know if I could use a variable, as in<br><br>final String suffix = "Suffix";
<br>when n : Name (value matches ("(.*)" + suffix))<br>then TakeAction(n, suffix)<br><br>but even then, the code is less expressive and the match would need to<br>repeated; in any event, I'd like to be able to write something along
<br>the lines of:<br><br>when n : Name (value matches "(.*)Suffix") .... some way to bind<br>"presuffix" to $1 ....<br>then TakeAction(presuffix)<br><br>where "presuffix" captures $1 in the match. This way, I'd have to
<br>change "Suffix" only once.<br><br> - Godmar<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>