title: a{0,1}|b{0,1} matches only 'a', why?
body: <p>Why is this happening? I've a complex regexp, but here is what is driving me crazy.</p>
  
  <pre><code>a|b
  </code></pre>
  
  <p>Matches either single <code>a</code> or single <code>b</code>.</p>
  
  <pre><code>a+|b+
  </code></pre>
  
  <p>Matches either series of <code>a</code> or series of <code>b</code>.</p>
  
  <pre><code>a{1}|b{1}
  </code></pre>
  
  <p>Matches both single letter the same.</p>
  
  <p>But I need to do this:</p>
  
  <pre><code>a{0,2}|b{0,2}
  </code></pre>
  
  <p>And this regexp matches only <code>a</code> and no <code>b</code> at all. What's wrong with that?</p>
  
  <p>What is even funnier is that if I change the <code>0</code> to <code>1</code>, so that it's <code>{1,2}</code>, it starts to match correctly (or better, as expected) again.</p>
  
  <p>Since it seems it now quite clear, I'm adding my real example:</p>
  
  <pre><code>my $launch_regexp = '(\d*)d{0,1}(\d*)(\+{0,2}|-{0,2})(\d*)';
  ($dice, $fc, $op, $mod) = ($launch =~ /$launch_regexp/);
  </code></pre>
  
  <p>Where <code>$launch</code> is the same of <code>$ARGV[1]</code>.</p>
  
  <p>I want to match many things. Examples:</p>
  
  <pre><code>3 (numbers)
  
  d10 (d + numbers)
  
  3d10 (numbers + d + numbers)
  
  3d10+/-5 (numbers + d + numbers + (+|-) + numbers)
  
  3d10++/--5 (numbers + d + numbers + (++|--) + numbers)
  </code></pre>
  
  <p>I know my regexp also matches other strings, but now it works with <code>+</code> and not with <code>-</code>.</p>
  
  <p>If I change the range with <code>{1,2}</code>, it matches strings with both + and - (but I need to match also strings which have not such modifiers).</p>
  
  <p>This is happening on my machine with Perl 5.16.3 and I'm able to reproduce it on <a href="http://www.regular-expressions.info/javascriptexample.html" rel="nofollow">this website</a>.</p>