title: How to make validation username using preg_match?
body: <p>I would like to create a <code>preg_match</code> function to validate my username, my code below not working perfectly, especially on <code>Must contain at least 4 letter lowercase</code> rules and <code>number not more than 4 character and place behind letter</code></p>
  
  <pre><code>if (preg_match('/^[a-z0-9]{4,12}/', $_POST['username']))
  </code></pre>
  
  <p>Here are my username rules that I want to work :</p>
  
  <ul>
  <li>Only contain letter and numbers but number is not reqired</li>
  <li>Must contain at least 4 letter lowercase</li>
  <li>Number not more than 4 character and place behind letter</li>
  <li>Must be 4-12 characters</li>
  </ul>
  
  <p>Thank you for any help you can offer.</p>