title: regular expressions : (.*), (.*?) and .*
body: <p>Could someone explain to me the difference between these 3 blocks:</p>
  
  <pre><code>1 -&gt; (.*)
  2 -&gt; (.*?)
  3 -&gt; .*
  </code></pre>
  
  <p>As I understand, <code>?</code> makes the last character optional so why put it <code>?</code> And why not put the parenthesis at the end?</p>
  
  <p>This comes from here: <a href="http://www.tutorialspoint.com/python/python_reg_expressions.htm" rel="noreferrer">http://www.tutorialspoint.com/python/python_reg_expressions.htm</a></p>
  
  <pre><code>1st example : searchObj = re.search( r'(.*) are (.*?) .*', line, re.M|re.I)
  </code></pre>