I've written a password checking function that uses preg_match as :
if (preg_match('/[a-z0-9]{5,10}/i', $pWord))
{
return $pWord; // Good password
}
else
// return error;
This allows me to check for passwords that contain alpha-numerics and are 5 to 10 chars in length. But I wanted to pass the function min and max values instead, as :
if (preg_match('/[a-z0-9]{$min,$max}/i', $pWord))
It seems the function is ignoring these values. Any suggestions?
Also, what is the correct syntax here for allowing special chars, such as "!@#$%" etc.? I tried the following, but it didn't work :
if (preg_match('/[a-z0-9!@#$%]{5,10}/i', $pWord))
Thanks in advance.