On Mon, Feb 17, 2003 at 07:40:46PM -0000, Matt Groves wrote:
> 
> Hello,
> 
> I'm looking for the shortest, cleverest possible solution to this.  When
> changing a password, I need a RegExp which will ensure the following
> criteria :
> 
> 1. It must be at least 6 characters
> 
> 2. It must contain at least one lower case letter [a-z]
> 
> 3. It must contain at least one upper case letter [A-Z]
> 
> 4. It must contain at least one number [0-9]
> 
> 5. Optionally, it can cover for accepted non-alphanumeric chars such as
> "_", "-" etc (but not "#"), and a maximum password length of 14
> characters

How about,

sub valid_password {
    return /^[-\w]{6,14}$/ && /[0-9]/ && /[a-z]/ && /[A-Z]/ for $_[0];
}

Paul

-- 
Paul Makepeace ....................................... http://paulm.com/

"If she comes home tonight, then the grass would not finish growing so
 soon."
   -- http://paulm.com/toys/surrealism/

Reply via email to