Bug #16358 Updated: Problem with ereg

From: Date: Mon, 01 Apr 2002 03:04:16 +0000
Subject: Bug #16358 Updated: Problem with ereg
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-3712@lists.php.net to get a copy of this message
ID: 16358 Updated by: webmaster@crescentart.com Reported By: webmaster@crescentart.com Status: Bogus Bug Type: *Regular Expressions Operating System: Linux Red HAt 7.1 PHP Version: 4.1.2 New Comment: I have found the error in my ereg script. Please discregard the bug report that I submitted. Previous Comments: ------------------------------------------------------------------------ [2002-03-31 05:46:06] sander@php.net This is NOT a support forum! ------------------------------------------------------------------------ [2002-03-30 15:33:55] webmaster@crescentart.com 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."); } ------------------------------------------------------------------------ [2002-03-30 05:44:30] mfischer@php.net 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] sander@php.net 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] webmaster@crescentart.com 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

« previous php.bugs (#3712) next »