title: Regular expression for a username
body: <p>I'm trying to write a regular expression for a username that fits the following criteria...</p>
  
  <p>Must be between 6 and 16 characters,
  any 4 of which must be letters (though not necessarily consecutive),
  May also contain letters, numbers, dash and underscore.</p>
  
  <p>So <code>_1Bobby1_</code> and <code>-Bo-By19-</code> would match, but <code>_-bo-_</code> and <code>-123-456_</code> wouldn't.</p>
  
  <p>I've tried:</p>
  
  <pre><code>^(?=.*[a-zA-Z].{4})([a-zA-Z0-9_-]{6,16})$
  </code></pre>
  
  <p>But this doesn't seem to work, I've looked online and can't find anything that works and used Regexper to visualise the expression and try to build it from scratch.</p>
  
  <p>Any pointers would be greatly appreciated.</p>