I'm a complete novice when it comes to regex. Could someone help me convert the following expression to preg?
ereg('[a-zA-Z0-9]+[[:punct:]]+', $password)
An explanation to accompany any solution would be especially useful!!!!
To answer your real question, you'd need to structure your code like:
if ( preg_match( '/[a-z]+/', $password ) &&
preg_match( '/[A-Z]+/', $password ) &&
preg_match( '/[0-9]+/', $password ) &&
preg_match( '/[[:punct:]]+/', $password ) ) ...
If you wanted to ensure the presence of at least one lowercase letter, at least one uppercase letter, at least one digit, and at least one punctuation character in your password.
Other questions you should read: