title: Complete word matching using grepl in R
body: <p>Consider the following example: </p>
  
  <pre><code>&gt; testLines &lt;- c("I don't want to match this","This is what I want to match")
  &gt; grepl('is',testLines)
  &gt; [1] TRUE TRUE
  </code></pre>
  
  <p>What I want, though, is to only match 'is' when it stands alone as a single word. From reading a bit of perl documentation, it seemed that the way to do this is with \b, an anchor that can be used to identify what comes before and after the patter, i.e. \bword\b matches 'word' but not 'sword'. So I tried the following example, with use of Perl syntax set to 'TRUE': </p>
  
  <pre><code>&gt; grepl('\bis\b',testLines,perl=TRUE)
  &gt; [1] FALSE FALSE
  </code></pre>
  
  <p>The output I'm looking for is <code>FALSE TRUE</code>. </p>