title: Return only the regex match, not the whole line
body: <p>I have a multiline document from which I'm looking to extract a particular keyword and the word after that. It looks like this:</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code>This is key word1 line 1.
  
  This is line 2.
  
  This is key word2 line 3. 
  </code></pre>
  
  <p>If I use <code>egrep 'key [^s]+ '</code>, the output is:</p>
  
  <pre class="lang-none prettyprint-override"><code>This is key word1 line 1.
  
  This is key word2 line 2. 
  </code></pre>
  
  <p>However, I'd like the output to be the match only as opposed to the whole line, that is:</p>
  
  <pre class="lang-none prettyprint-override"><code>key word1
  
  key word2
  </code></pre>
  
  <p>Is there a way to do that?</p>