Page 1 of 1

need some clarification with preg_match to match password

Posted: Sat Nov 29, 2014 4:54 pm
by PHPHelpNeeded
I am using this pattern I found in the search:

Code: Select all

        $match_result = array();
        $password = "time123456789";
	$result = preg_match('/^([a-zA-Z0-9]{8,32})$/i', $password, $match_result);
I keep getting result == false, and I cannot figure out how to match it properly.

I would also like to have it so you can use special characters like (.~!@#$%^&*), whether they are all upper case or all lower case or mixed it don't matter.

Anyhelp?

Re: need some clarification with preg_match to match passwor

Posted: Sat Nov 29, 2014 5:02 pm
by Celauran
What is it you're trying to do here?

Re: need some clarification with preg_match to match passwor

Posted: Sat Nov 29, 2014 6:17 pm
by PHPHelpNeeded
I trying to find whether the password enter as a subject matches the pattern that would tell me whether the password was entered in a combination of letter(lower or upper) with numbers and special.

Re: need some clarification with preg_match to match passwor

Posted: Sat Nov 29, 2014 6:21 pm
by Celauran
If you're allowing letters, numbers, and special characters, it might be a lot easier to do an inverse match (ie. make sure it doesn't match disallowed characters)