title: Equivalent regular expression
body: <p>I have this Regular Expression:</p>
  
  <pre><code>/^(?:'[A-z](([\._\-][A-z0-9])|[A-z0-9])*[a-z0-9_]*')$/
  </code></pre>
  
  <p>and I'm trying to build an equivalent one, still no success.</p>
  
  <p>For more information, it's a regex for a username. This are the rules:</p>
  
  <ul>
  <li>Should start with a letter </li>
  <li>Can have . - or _ in the middle of the username (like john__, or john.m, or kate-7)</li>
  <li>Can't end with . or -, but it can end with several _ (like matt__)</li>
  <li>Can end with numbers (like chloe77)</li>
  </ul>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I'm using Codeigniter regex_match and it has a bug, doesn't accept pipes. So the equivalent regular expression should not have the pipe.</p>
  
  <p>I would appreciate any help. Thanks in advance.</p>