Validating for at least one upper case one lower case or special character present in a stringWe have seen how to check for all the upper case letters or all lower case letters ( or special chars ) presence in a string variable. However we may need a situation where we have to ask the user (while entering password ) to enter at least one lower case letter or one upper case letter or one special characters.
We will check one by one first and then develop a script to combine all these points.
This code will be useful for checking at server side ( not client side ) password entered by user.
Check for at least one upper case characterWe used preg_match which returns True of False after checking the string.
The output is
Check for at lease one lower case character
Checking for presence of blank space inside stringWe will use string search function strstr() to search for presence of blank string inside.
Check for special characters