title: greedy character matching at end of string
body: <p>I'm trying to match the following string:</p>
  
  <p><code>controller1/action1/something</code></p>
  
  <p>With the following regex:</p>
  
  <p><code>(?P&lt;controller&gt;[[:alnum:]]+)/(?P&lt;action&gt;[[:alnum:]]+)/(.*)</code></p>
  
  <p>For some reason it doesn't find the last part of the string: <code>something</code>. But it works when i change the <code>*</code> to <code>+</code> at the end of the regex:</p>
  
  <p><code>(?P&lt;controller&gt;[[:alnum:]]+)/(?P&lt;action&gt;[[:alnum:]]+)/(.+)</code></p>
  
  <p>With that regex it does find the <code>something</code> string. But i want to use <code>.*</code> (or <code>.*?</code>) because i want this regex to succeed also when it doesn't have something at the end.</p>
  
  <p>So it should also succeed when the string is: <code>controller1/action1/</code></p>
  
  <p>So why doesn't it work with <code>(.*)</code> or <code>(.*?)</code> but works with <code>.+</code>? The difference should simply be that the first says "zero or more characters" and the last "one or more". I simply want to check for "zero or more".</p>
  
  <p>PS. I don't want to use <code>^</code> and <code>$</code> to denote the beginning and end of the string due to a complexer problem. Simply stated, this pattern doesn't always occur for strings at the end.</p>