title: Make sure username contains only: A-Z, a-z, ., _, -, 0-9 (no comma) PHP
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3028642/regular-expression-for-letters-numbers-and">regular expression for letters, numbers and - _ </a>  </p>
  </blockquote>
  
  
  
  <p>I am creating a signup form in PHP and need to ensure that user's usernames don't contain unwanted characters. Is there anyway I can create a function that returns true for <code>A-Z a-z 0-9 - . _</code>.</p>
  
  <p>Also I do not want the user's emails to be from yahoo as for some reason they reject the confirmation emails sent. Along with <code>__FILTER_VALIDATE_EMAIL__</code>what would I need to add?</p>
  
  <p>PS: is there anything wrong with the characters I have mentioned above? I have noted that gmail doesn't allow <code>-_</code> only . and YouTube only alpha-numeric characters.</p>