<br> Yes, comma in this case is cleaner, but && should work too. What error do you see? What version of Drools are you using?<br><br> []s<br> Edson<br><br><div class="gmail_quote">2009/6/1 Greg Barton <span dir="ltr"><<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Try a comma instead of &&<br>
<div class="im"><br>
WrapperClass( sentence matches ".*Alpha.*", sentence2 matches ".*Beta*.")<br>
<br>
</div>--- On Mon, 6/1/09, Armaghan Mahmud <<a href="mailto:mahmud.armaghan@gmail.com">mahmud.armaghan@gmail.com</a>> wrote:<br>
<br>
> From: Armaghan Mahmud <<a href="mailto:mahmud.armaghan@gmail.com">mahmud.armaghan@gmail.com</a>><br>
> Subject: Re: [rules-users] String comparison question<br>
> To: "Rules Users List" <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
> Date: Monday, June 1, 2009, 11:12 AM<br>
<div><div></div><div class="h5">> Thanks for your reply Edson. What<br>
> if I want to test for multiple substrings in different<br>
> strings?<br>
> <br>
> For example, how can I find beta in sentence2?<br>
><br>
> I tried to combine WrapperClass( sentence matches<br>
> ".*Alpha.*" && sentence2 matches<br>
> ".*Beta*.") but I got errors.<br>
><br>
> Thanks,<br>
> Armaghan<br>
> <br>
> 2009/5/31 Edson Tirelli <<a href="mailto:tirelli@post.com">tirelli@post.com</a>><br>
><br>
><br>
> If the string you are looking for is a substring of<br>
> your sentence, you need to either use a regexp or an eval to<br>
> call for an indexOf-like method:<br>
><br>
><br>
> WrapperClass( sentence matches ".*Alpha.*" )<br>
><br>
> []s<br>
> Edson<br>
><br>
><br>
> 2009/5/31 Armaghan Mahmud <<a href="mailto:mahmud.armaghan@gmail.com">mahmud.armaghan@gmail.com</a>><br>
><br>
><br>
><br>
><br>
><br>
> Hey guys,<br>
> <br>
> I read in a previous post that == in Drools 4.0.7 maps<br>
> to .equals() automatically. My situation required me to put<br>
> a String object into the working memory and do a comparison<br>
> on it to see if a particular word is in the passed String<br>
> sentence. Could anybody please guide me as to how to<br>
> approach this problem? Thanks in advance. Here's my<br>
> original code:<br>
><br>
> <br>
><br>
> rule "Find Alpha in a<br>
> sentence"<br>
> salience100<br>
> wrap: WrapperClass(Sentence == "Alpha")<br>
> then<br>
> System.out.println("Aha found<br>
> ya!");<br>
> end<br>
> <br>
> <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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> Edson Tirelli<br>
> JBoss Drools Core Development<br>
> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
><br>
><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
><br>
><br>
><br>
</div></div>> -----Inline Attachment Follows-----<br>
<div><div></div><div class="h5">><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
<br>
<br>
<br>
<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>