title: Regular Expression - Small change needed
body: <p>I need a regular expression that will allow only a to z and 0 to 9. I came across the function below on this site, but it allows a few symbols thru (#.-). How should it be done if it has to allow only a to z (both upper and lower case) and 0 to 9? I'm scared to edit it since I know nothing about regular expressions.</p>
  
  <p>Also is this regular expression good to check for a to z and 0 to 9, or is there any way it can be bettered.</p>
  
  <pre><code>function isValid($str) {
      return !preg_match('/[^A-Za-z0-9.#\\-$]/', $str);
  }
  </code></pre>
  
  <p>Thanks</p>