<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Great! I will try out. Thank you so much for your detail explanation!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Stacy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b>On Behalf Of </b>Wolfgang Laun<br>
<b>Sent:</b> Thursday, March 27, 2014 11:33 AM<br>
<b>To:</b> Rules Users List<br>
<b>Subject:</b> Re: [rules-users] How to do word match in drools?<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">See inline.<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On 27 March 2014 16:59, Yuan, Stacy [DBA] &lt;<a href="mailto:stacyy@telenav.com" target="_blank">stacyy@telenav.com</a>&gt; wrote:<o:p></o:p></p>
<p class="MsoNormal">Hi,<br>
<br>
I am new to this area. Thank you very much for your reply!<br>
<br>
This is current script<br>
<br>
brandName matches &quot;(?i)(.*cyber.*|.*internet.*|.*pizza.*|.*restaurant.*|.*sushi.*)<br>
<br>
So this &nbsp;matches every string containing sushi.<br>
<br>
Joa Sushie Café<br>
Java Sushi<br>
Sushi Blvd<br>
Japanese Sushi Bar<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">This is to be expected: each of these 4 lines contains &quot;sushi&quot;.<br>
<br>
&nbsp;<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><br>
But I only want to match the word sushi. This means &quot; Joa Sushie Café&quot; will not be included.<br>
<br>
Actually I am looking for word match. What is the best way to include above words?<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">All regular expressions I know have a way for expressing the concept &quot;word boundary&quot;.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">This is a zero-length assumption (or &quot;anchor&quot;), that matches a transition from a word character<br>
to a non-word character. (Note that the definition of &quot;word character&quot; may not *always*<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">meet your expectations, but it should in this case.)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
brandName == &quot;(?i)(.*cyber.*|.*internet.*|.*pizza.*|.*restaurant.*|.*sushi.*)???<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">(The &quot;==&quot; is bad: you want to do a pattern match.) OK, to restrict the &quot;sushi&quot; to the
<br>
real thing (assuming the final &quot;???&quot; aren't relevant):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; brandName matches &quot;(?i)(...|... ...|\\bsushi\\b)&quot;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">&quot;\b&quot; is the word boundary anchor, and you have to duplicate the backslash, as in Java.<br>
&nbsp;If the same borderline case should hold for pizza and others, you could use<br>
<br>
&nbsp;&nbsp;&nbsp; brandName matches &quot;(?i).*\\b(cyber|internet|pizza|restaurant|sushi)<a href="file:///\\b.*">\\b.*</a>&quot;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">All of this is untested, but it shouldn't be very far off the mark.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">-W<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">&nbsp;<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal"><br>
Best<br>
<br>
Stacy<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Wolfgang Laun<br>
Sent: Thursday, March 27, 2014 12:26 AM<br>
To: Rules Users List<br>
Subject: Re: [rules-users] How to do word match in drools?<br>
<br>
You can use == to compare strings.<br>
<br>
For a more comprehensive answer, ask a more detailed question.<br>
<br>
-W<br>
<br>
On 26/03/2014, Yuan, Stacy [DBA] &lt;<a href="mailto:stacyy@telenav.com">stacyy@telenav.com</a>&gt; wrote:<br>
&gt; For example, &nbsp;word sushi<br>
&gt; I do not want sushie show up and shsushi show up when we do drools match.<br>
&gt;<br>
&gt; Thanks<br>
&gt; Stacy<br>
&gt;<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>
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><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>