title: how to grep for 'vector' but not 'std::vector'
body: <p>I've spotted a <code>using namespace std;</code> in a common header in our code, and I want to remove it.</p>
  
  <p>Consequently, I need to replace all occurrences of <code>vector</code> in my code with <code>std::vector</code>.</p>
  
  <p>I need to write an expression to grep it, that ignores the following cases:</p>
  
  <pre><code>std::vector
  // comment with a vector
  "string with a vector"
  </code></pre>
  
  <p>so that I don't end up replacing them like</p>
  
  <pre><code>std::std::vector
  // comment with a std::vector
  "string with a std::vector"
  </code></pre>
  
  <p>So far, I've managed to ignore the ''std::vector'' case using the expression</p>
  
  <pre><code>grep "^[^:]*vector" *.h
  </code></pre>
  
  <p>But I have problems composing negations, like:</p>
  
  <ul>
  <li>find "<strong><em>X</em></strong>" but not "<strong><em>YX</em></strong>" nor "<strong><em>Y.*X</em></strong>"</li>
  </ul>
  
  <p>can anybody help ?</p>