title: How does will the regex works in my PHP code?
body: <p>I have this piece of code, actually, I don't know anything about <em>Regex</em>, however I want to know what will this code do and if I wrote it right.
  If the user only type letters and numbers, in the variable <em>$username</em>, that is used to collect the data in the field, then do something as login. Else, tell the user that he can't type symbols as !@#$% in the field. Please, is it right?</p>
  <pre><code>if(preg_match('[A-Za-z0-9]', $username)){
      //Do something good, as login
  }else{
      //Do something bad, as show error message
  }
  </code></pre>