title: detect strings that both includes and excludes certain word (with stringr package)
body: <p>Newbie here and couldn't find an answer to my question. I have string observations in my string variable and try to detect MS OR MA OR Master but exclude MBA:</p>
  
  <pre><code>input &lt;- c("Master of Business Administration (MBA) program", "MS, MA, Master", "Master")
  </code></pre>
  
  <p>desired output with <code>str_detect</code>: </p>
  
  <pre><code>False, True, True
  </code></pre>
  
  <p>Edit: this worked for me now:</p>
  
  <pre><code>str_detect(input, "\\bMS\\b|\\bMaster\\b|\\bMA\\b") &amp; !str_detect(input,"\\bMBA\\b")
  </code></pre>