title: Pattern matcher using Greedy and Reluctant
body: <p>In java <code>regex</code> I have read about <a href="https://stackoverflow.com/questions/5319840/greedy-vs-reluctant-vs-possessive-quantifiers">Greedy and Reluctant Quantifiers</a>. They mentioned as </p>
  
  <blockquote>
    <p>A reluctant or "non-greedy" quantifier first matches as little as
    possible. So the .* matches nothing at first, leaving the entire
    string unmatched</p>
  </blockquote>
  
  <p>In this example</p>
  
  <blockquote>
    <p>source: <code>yyxxxyxx</code><br>
    pattern: <code>.*xx</code></p>
  </blockquote>
  
  <p>greedy quantifier <code>*</code> and produces</p>
  
  <pre><code>0 yyxxxyxx
  </code></pre>
  
  <p>reluctant qualifier <code>*?</code>, and we get the following:</p>
  
  <pre><code>0 yyxx
  4 xyxx
  </code></pre>
  
  <p>Why result of <code>yxx</code>, <code>yxx</code> not possible even it is the smallest possible value?</p>