title: What does .*? regular expression actually means?
body: <p>I've been using perl for a decade. But lately I've got confused with using .*? regex.</p>
  
  <p>It does not seem to match the minimum number of characters. Sometimes it gives different results.</p>
  
  <p>For example for this string:aaaaaaaaaaaaaaaaaaaaaaammmmmmmmmmmbaaaaaaaaaaaaaaaaaaaaaab and pattern: a.*?b it matches complete input string in two groups. As per the definition it should have matched the last "ab". </p>