title: How to match a substring at the end of a string in R?
body: <p>I'm using grepl to detect if a string includes a substring. For example:</p>
  
  <pre><code>grepl("-B4","P6-B4")
  </code></pre>
  
  <p>which obviously returns True. Now I want to avoid cases which have characters after the "-B4" substring. For example I want to see False from the following:</p>
  
  <pre><code>grepl("-B4","P6-B41A")
  </code></pre>
  
  <p>As you can see the reason I want to avoid it is because 4 is different from 41 and I don't want to detect 41.
  Thanks </p>