It depends how complex you want to get. If you just want to check the length of characters, don't use a preg, because it's really very inefficient. What I'd suggest is using a mixture of the different String Functions, such as strlen, trim and strncmp. Other than that the suggestion of preg was a good idea. For example,
if(!preg_match("#^[a-z0-9]{6,}$#i", $sPassword)) {
echo "Invalid length, or invalid characters in password!";
} else {
echo "Valid! Nice one bruv!";
}