I need a regex that allow user to insert a password in a field. But the only allowed regex are [A-Za-z0-9] ok, but also "space", ".", "_", "-". How can is possible allow the special chars I listed, but NOT TO FORCE user to use that? On the other hand, disallow all the other special chars.
Is it possible?
With this code I check the quality of the password, but not sufficient for my goal cause I cannot manage the special chars:
else if ($check_strength && (!preg_match("/[0-9]/", $newpwd) || !preg_match("/[^A-Za-z0-9]/", $newpwd))) {
$rcmail->output->command('display_message', $this->gettext('passwordweak'), 'error');
}
I've solved my problem with this one:
"/^[A-Za-z0-9\.\-\_]+$/"