title: Greedy Quantifiers
body: <p>I was reading K.Sierra and found the following sentance:</p>
  
  <blockquote>
    <p>The greedy quantifier does in fact read the entire source data, and then it works
    backward (from the right) until it finds the rightmost match. At that point, it
    includes everything from earlier in the source data up to and including the data that
    is part of the rightmost match.</p>
  </blockquote>
  
  <p>Now, Suppose we have a source as follows:</p>
  
  <pre><code>"proj3.txt,proj1sched.pdf,proj1,proj2,proj1.java"
  </code></pre>
  
  <p>and pattern: <code>proj1([^,])*</code></p>
  
  <p>why doesn't it match the whole text? Being greedy it should have match the rightmost "proj1.java" and the returned match should have been the entire source before the right most match? Instead it returns:</p>
  
  <pre><code>proj1sched.pdf
  proj1
  proj1.java
  </code></pre>