title: Regular Expressions, Python 3,
body: <p>I have problems to understand this regular expression in python:</p>
  
  <pre><code>re.findall(r'([a-z]+?)\w*', "Ham, spam, and, eggs")
  </code></pre>
  
  <p>I understand that:</p>
  
  <ul>
  <li><code>[a-z]</code> is a class that includes the all letters from a-z</li>
  <li><code>+</code> says that it can appear at least once</li>
  <li><code>?</code> is it can appear once or never</li>
  </ul>
  
  <p>My output for <code>([a-z]+?)</code> is:</p>
  
  <pre><code>['a', 'm', 's', 'p', 'a', 'm', 'a', 'n', 'd', 'e', 'g', 'g', 's']
  </code></pre>
  
  <p>Now the problems start:</p>
  
  <p>if I test:</p>
  
  <pre><code>re.findall(r'([a-z]+?)\w', "Ham, spam, and, eggs")
  </code></pre>
  
  <p>My output is:</p>
  
  <pre><code>['a', 's', 'a', 'a', 'e', 'g']  # Why?
  </code></pre>
  
  <p>and if i test the full expression:</p>
  
  <pre><code>re.findall(r'([a-z]+?)\w*', "Ham, spam, and, eggs")
  </code></pre>
  
  <p>my output is:</p>
  
  <pre><code>['a', 's', 'a', 'e'] # Why?
  </code></pre>
  
  <p>Can somebody explain this to me, please?</p>