title: perl regex of exactly 10 characters
body: <p>I'm using perl flavored regexes in PHP with the <code>preg_match</code> function. I want to validate a key that is exactly 10 characters, with upper case alpha characters or numbers. </p>
  
  <p>I have</p>
  
  <pre><code>preg_match( '/[^A-Z0-9]/', $key);
  </code></pre>
  
  <p>which finds invalid characters next to valid ones. In my limited knowledge, I tried</p>
  
  <pre><code>preg_match( '/[^A-Z0-9]{10}$/', $key);
  </code></pre>
  
  <p>which turns out to match <em>all</em> my test strings, even the invalid ones. </p>
  
  <p>How do I specify this regular expression? </p>