title: javascript regular expression to not match a word
body: <p>How do I use a javascript regular expression to check a string that does not match certain words?</p>
  
  <p>For example, I want a function that, when passed a string that contains either <code>abc</code> or <code>def</code>, returns false.</p>
  
  <p>'abcd' -> false</p>
  
  <p>'cdef' -> false</p>
  
  <p>'bcd' -> true</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Preferably, I want a regular expression as simple as something like, [^abc], but it does not deliver the result expected as I need consecutive letters. </p>
  
  <p>eg. I want <code>myregex</code></p>
  
  <pre><code>if ( myregex.test('bcd') ) alert('the string does not contain abc or def');
  </code></pre>
  
  <p>The statement <code>myregex.test('bcd')</code> is evaluated to <code>true</code>.</p>