title: How to properly check this regex using python
body: <p>I am trying to Check if the input is in this pattern : <strong>MH12</strong> </p>
  
  <p>Starting two digits to be MH then next two digits to be any number
  and The full string should be 4 digits only. so Tired with <code>regex = r'^[MH]\d{2}.{,4}$'</code></p>
  
  <p>import re</p>
  
  <pre><code>def checkingInput():
      while True:
          try:
              inp = raw_input()
              if re.match(r'[MH]\d{2}', inp):
                  print "Thanks for your Input:",inp
                  break
              else:
                  print('Invalid office code, please enter again :')
          except ValueError:
                  print('Value error! Please try again!')
  
  
  checkingInput()
  </code></pre>
  
  <p>but the above program even for <strong>input = MH12</strong> it it showing Invalid Office code. Why so?</p>
  
  <p>May be I am missing something?</p>