Re: RegEx help

From: Date: Thu, 14 Apr 2005 14:31:44 +0000
Subject: Re: RegEx help
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-213090@lists.php.net to get a copy of this message
Philip Hallstrom wrote:
On Thu, 14 Apr 2005, Bosky, Dave wrote:
I wanted to create a regex that force a PHP form text field to meet the following requirements: a. Must contain an 1 uppercase letter. [A-Z] b. Must contain 1 digit. [0-9] c. Must be a minimum of 7 characters in length. {7}
if ( ereg("[A-Z0-9]", $field) && strlen($field) >= 7 ) {
    print("We have a winner!");
} nope, a username like "1234567" would go trough ok. Which isn't what he wanted


« previous php.general (#213090) next »