title: Is it possible to create a regex to match a line that contains one word but not another?
body: <p><a href="https://stackoverflow.com/questions/2953039/regular-expression-for-a-string-containing-one-word-but-not-another">Similar</a> <a href="https://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word">questions</a> <a href="https://stackoverflow.com/questions/7839852/regex-find-one-word-but-not-another">have</a> <a href="https://stackoverflow.com/questions/9912914/regular-expression-searching-matching-one-word-but-not-another">been</a> asked, but none answer this specific question.</p>
  
  <p>Given this representative text:</p>
  
  <pre><code>foo
  bar
  foo bar
  bar foo
  foo bar foo
  bar foo bar
  </code></pre>
  
  <p>Is it possible to use regular expressions to match only lines that do contain the word <code>foo</code> but don't contain the word <code>bar</code>?</p>
  
  <p>If this desired regular expression was run on the above text, it would only result in:</p>
  
  <pre><code>foo
  </code></pre>