title: Simple Grep Mismatch problem
body: <p>I am using Ubuntu 10.10 and using Grep to process some HTML files.</p>
  
  <p>Here is the HTML snippet:</p>
  
  <pre><code>&lt;a href="video.php?video=one-hd.mov"&gt;&lt;img src="/1.jpg"&gt;&lt;a href="video.php?video=normal.mov"&gt;&lt;img src="/2.jpg"&gt;&lt;a href="video.php?video=another-hd.mov"&gt;
  </code></pre>
  
  <p>I would like to extract <code>one-hd.mov</code> and <code>another-hd.mov</code> but ignore <code>normal.mov</code>.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>example='&lt;a href="video.php?video=one-hd.mov"&gt;&lt;img src="/1.jpg"&gt;&lt;a href="video.php?video=normal.mov"&gt;&lt;img src="/2.jpg"&gt;&lt;a href="video.php?video=another-hd.mov"&gt;'
  echo $example | grep -Po '(?&lt;=video.php\?video=).*?(?=-hd.mov"&gt;)'
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>one
  normal.mov"&gt;&lt;img src="/2.jpg"&gt;&lt;a href="video.php?video=another
  </code></pre>
  
  <p>But I want </p>
  
  <pre><code>one
  another
  </code></pre>
  
  <p>There is a mismatch there. </p>
  
  <p>Is this because of the so-called <strong>Greedy</strong> Regular Expression?</p>
  
  <p>I am sing GREP but any command line bash tools are welcome to solve this problem like sed etc.</p>
  
  <p>Thanks a lot.</p>