title: Regular expression to only allow lower-case letters
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3579531/regular-expressions-low-caps-dots-zero-spaces">Regular Expressions: low-caps, dots, zero spaces</a>  </p>
  </blockquote>
  
  
  
  <p>How could I change the regular expression below to only allow lower-case letters?</p>
  
  <pre><code>function valid_username($username, $minlength = 3, $maxlength = 30)
  {
  
      $username = trim($username);
  
      if (empty($username))
      {
          return false; // it was empty
      }
      if (strlen($username) &gt; $maxlength)
      {
          return false; // to long
      }
      if (strlen($username) &lt; $minlength)
      {
  
          return false; //toshort
      }
  
      $result = ereg("^[A-Za-z0-9_\-]+$", $username); //only A-Z, a-z and 0-9 are allowed
  
      if ($result)
      {
          return true; // ok no invalid chars
      } else
      {
          return false; //invalid chars found
      }
  
      return false;
  
  }
  </code></pre>