PDA

View Full Version : preg_match help required for password security


pwebb
02-05-2007, 11:41 PM
Hi,

Could anyone please help with the preg_match expression I will need to perform the following.

I need it to check a password field for a password that contains :-

numeric chars (min of 1)
upper case letters (min of 1)
lower case letters (min of 1)
The password must be at least 6 characters and only be made up of upper and lower case letters and numbers.

Any help would be greatly appreciated.

Regards,

Cap'n Steve
02-06-2007, 03:14 AM
I'm not sure if that's possible in a single regular expression. Here's 4, though:
numeric chars (min of 1)
/\d/
upper case letters (min of 1)
/[A-Z]/
lower case letters (min of 1)
/[a-z]/
The password must be at least 6 characters and only be made up of upper and lower case letters and numbers.
/[a-z0-9]{6,}/i