ID: 16358 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: *Regular Expressions Operating System: Linux Red HAt 7.1 PHP Version: 4.1.2 New Comment:
I have tried using your suggestion and I am still having a problem with ereg and eregi allowing entries with out numbers. if(!eregi("^[a-z0-9]+$", "$pass")){ die("Your passowrd does not meet security requirments. Use your back button to make corrections."); } Previous Comments: ------------------------------------------------------------------------ [2002-03-30 05:44:30] [EMAIL PROTECTED] You regex only matches on character. append a '+' at the end of the character-class modifier, e.g. if (!eregi('^[a-z0-9]+$', ... ------------------------------------------------------------------------ [2002-03-30 03:48:27] [EMAIL PROTECTED] The bug system is not the appropriate forum for asking support questions. For a list of a range of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php ------------------------------------------------------------------------ [2002-03-30 02:40:13] [EMAIL PROTECTED] Since I have been using php I have had a problem with the ereg function not mathcing patterns properly. For example I am trying the use ereg to ensure that users use passowrds that contain a combination of letters and numbers. These are my HTML and PHP codes: <input type="password" name="password"> if(!ereg("([a-zA-Z0-9])", "$password")){ echo "Bad Password"; } The problem that I encounter with ereg is that I have been able to enter passwords from the html form that do not contain numbers and or only have mixed case letters but ereg IF statment does match the pattern and echo "Bad Password". ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16358&edit=1