title: Regular Expression Match to test for a valid year
body: <p>Given a value I want to validate it to check if it is a valid year. My criteria is simple where the value should be an integer with <code>4</code> characters. I know this is not the best solution as it will not allow years before <code>1000</code> and will allow years such as <code>5000</code>. This criteria is adequate for my current scenario.</p>
  
  <p>What I came up with is</p>
  
  <p><code>\d{4}$</code></p>
  
  <p>While this works it also allows negative values.</p>
  
  <p>How do I ensure that only positive integers are allowed?</p>