title: Roman numerals in Python using "re" module
body: <p>I'm working along on <a href="http://www.diveintopython.net/regular_expressions/roman_numerals.html" rel="nofollow">this page</a> and continuing the code to cover the 10's place. My "pattern" is:</p>
  
  <pre><code>&gt;&gt;&gt; pattern = '^M?M?M?(CM?|CD?|D?C?C?C?)(XC?|XL?|L?X?X?X?)$'
  </code></pre>
  
  <p>If I remove the carat (^) from the front of the "pattern", then strings like 'hat' will find a match:</p>
  
  <pre><code>&gt;&gt;&gt; pattern = 'M?M?M?(CM?|CD?|D?C?C?C?)(XC?|XL?|L?X?X?X?)$'    
  &gt;&gt;&gt; print re.search(pattern,'hat')
  &lt;_sre.SRE_Match object at 0x1004ba360&gt;
  </code></pre>
  
  <p>but when I leave the carat in the front, then it works fine and 'hat' doesn't find a match. What does the carat do and why does 'hat' find a match?</p>