title: Regex match being greedy after using non-greedy operator
body: <p>I have the following the text:</p>
  
  <pre><code>&lt;def id="1"&gt;[&lt;note&gt;AA2&lt;/note&gt;] Valer:&lt;ex&gt;asd&lt;/ex&gt;&lt;/def&gt;
  &lt;def id="2"&gt;AWEs: [&lt;note&gt;DDD1&lt;/note&gt;]:&lt;ex&gt;rfwc sdad&lt;/ex&gt;[&lt;note&gt;CC#2&lt;/note&gt;]:&lt;ex&gt;saq www&lt;/ex&gt;[&lt;note&gt;POL1&lt;/note&gt;]:&lt;ex&gt;Sasd.&lt;/ex&gt;&lt;/def&gt;
  &lt;def id="3"&gt;Esd: [&lt;note&gt;AAA&lt;/note&gt;]:&lt;ex&gt;qw wq.&lt;/ex&gt;[&lt;note&gt;PS0&lt;/note&gt;]:&lt;ex&gt;sad sadad.&lt;/ex&gt;&lt;/def&gt;
  &lt;def id="4" type="L99"&gt;[&lt;note&gt;CARSF1&lt;/note&gt;] asddds:&lt;ex&gt;ass www.&lt;/ex&gt;&lt;/def&gt;
  </code></pre>
  
  <p>I'm trying to match when there's a <code>[</code> immediately after the <code>def</code> tag is opened.</p>
  
  <p>I've this pattern:</p>
  
  <pre><code>&lt;def\s.*?&gt;\[&lt;note&gt;(.*?)&lt;\/note&gt;\](.*?):&lt;ex&gt;(.*?)&lt;\/ex&gt;&lt;\/def&gt;
  </code></pre>
  
  <p>But it matches all lines and I'm not really sure why.</p>
  
  <p>Here's the <a href="http://www.regexr.com/3bt2q" rel="nofollow">demo</a></p>