title: PHP: Simple regular expressions to match length?
body: <p>I'm creating a registration system that needs to check the name/pass etc. with REGEX (and prefer to), what I've got so far is:</p>
  
  <pre><code>//Check so numbers aren't first, such as 00foobar
  preg_match('/^(?!\d)[a-z0-9]+$/iD',$usrname);
  //Just simple check
  preg_match('/^[a-zA-Z0-9]+$/',$psword);
  </code></pre>
  
  <p>But I have to do stupid things in IF statements like:</p>
  
  <p><code>if strlen($psword) &gt; 30 || if (strlen($psword) &lt; 4) ....</code> </p>
  
  <p>How would I impliment the length checking in my two original regular expression statements? This would make me so happy.. </p>