title: How to extract all regex matches in a file using Vim?
body: <p>Consider the following example:</p>
  <pre><code>case Foo:
      ...
      break;
  case Bar:
      ...
      break;
  case More: case Complex:
      ...
      break:
  ...
  </code></pre>
  <p>Say, we would like to retrieve all the regex matches (the whole matching text, or even better, the part between <code>\(</code> and <code>\)</code>) of the regex <code>case \([^:]*\):</code>, which should give us (preferably in a new new buffer) something like:</p>
  <pre><code>Foo
  Bar
  More
  Complex
  ...
  </code></pre>
  <p>Another use case example would be the extraction of some parts, for instance, URLs of images from an HTML file.</p>
  <p>Is there a simple way to graph all regex matches and put them in a buffer in Vim?</p>
  <p><strong>Note:</strong> It’s similar to the question “<a href="https://stackoverflow.com/questions/6564828/extract-text-using-vim">How to extract text matching a regex using Vim?</a>”. However, unlike the setting in that question, I’m also interested in removing the lines that don’t match, preferably without a huge or complex regex.</p>