title: Regex: Contains a word, doesn't contain another word
body: <p>I'm unsuccessfully trying to find a solution to this problem:
  <b>To find a Java regex that can recognize a String containing one word and not containing another word</b>.</p>
  
  <p>To be more clear, as an example, let's check if my sentence to contains "method" and do not contains "efficient" as whole words (meaning it has not to be part of another word). The regex matcher should return, e.g.,:</p>
  
  <pre><code>This method was efficient.      false   (contains "method", but contains "efficient")
  This method was unefficient.    true    (cont. "method" doesn't cont. "efficient")
  This method was simple.         true    (cont. "method" doesn't cont. "efficient")
  This routine is efficient       false   (cont. "efficient" but no "method")
  </code></pre>
  
  <p>What I've tried so far, at least the more nearest solution results.</p>
  
  <pre><code>( method )(?!.*efficient.*)      Almost there, but "unefficient" also triggers.
  ( method )(?!.* efficient .*)    No. Now " method " doesn't trigger anymore.
  ((.*method.*)(?!.*efficient.*))  No. the absence of "efficient" doesn't trigger.
  </code></pre>
  
  <p>So it seems to be a problem of exact word match. So I also tried at first:</p>
  
  <pre><code> (.*\bmethod\b.*)(?!.*efficient.*)
  </code></pre>
  
  <p>Also to not to depend on spaces to bound each word.
  But nothing. I tried almost the whole day and it's painful.</p>
  
  <p>I am using
  <a href="http://www.regular-expressions.info/refquick.html" rel="noreferrer">http://www.regular-expressions.info/refquick.html</a>
  as a reference website, and
  <a href="http://regexpal.com/" rel="noreferrer">http://regexpal.com/</a>
  for testing.</p>
  
  <p>Thank you!
  D.</p>